Qt | Qt development knowledge and experience summary

 by   lesliefish C++ Version: Current License: No License

kandi X-RAY | Qt Summary

kandi X-RAY | Qt Summary

Qt is a C++ library. Qt has no bugs, it has no vulnerabilities and it has medium support. You can download it from GitHub.

Qt development knowledge and experience summary. Including Qss, database, Excel, Model/View, etc.

            kandi-support Support

              Qt has a medium active ecosystem.
              It has 876 star(s) with 455 fork(s). There are 40 watchers for this library.
              It had no major release in the last 6 months.
              There are 2 open issues and 0 have been closed. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of Qt is current.

            kandi-Quality Quality

              Qt has no bugs reported.

            kandi-Security Security

              Qt has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              Qt does not have a standard license declared.
              Check the repository for any license declaration and review the terms closely.
              Without a license, all rights are reserved, and you cannot use the library in your applications.

            kandi-Reuse Reuse

              Qt releases are not available. You will need to build from source code and install.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of Qt
            Get all kandi verified functions for this library.

            Qt Key Features

            No Key Features are available at this moment for Qt.

            Qt Examples and Code Snippets

            No Code Snippets are available at this moment for Qt.

            Community Discussions


            Columns not properly moving in QTableView (QAbstractTableModel) using beginMoveColumns?
            Asked 2021-Jun-15 at 20:13

            I am trying to use beginMoveColumns to move a single column over in a QTableView, but it doesn't work properly in my example below. The cell selections get shuffled and column widths don't move. Moving rows using the same logic seems to work correctly. What am I doing wrong?

            Video: https://www.screencast.com/t/5UJ0iByZCEE



            Answered 2021-Jun-15 at 20:13

            Turns out it was a bug, I made a bug report here: https://bugreports.qt.io/browse/QTBUG-94503

            As a workaround I just clear cell selection on column move, and use this snippet to move column widths

            Source https://stackoverflow.com/questions/67941424


            Qt - trying to align two GroupBoxes in a layout
            Asked 2021-Jun-15 at 17:18

            A part of my form contains QGroupBox (Status Box) with 4 child QGroupBoxes arranged in a grid layout (2x2). Two bottom QGroupBoxes (Widget 1 Box and Widget 2 Box) contain widgets of fixed size (with set minimumSize and maximumSize) so they're non-resizable at all in both directions. Because of that rigid size constraints top row of QGroupBoxes (Summary Box and Helper Box) can only be resized in vertical direction.

            And here comes the troublesome part. Top-left QGroupBox (Summary Box) have grid layout 5x3 while top-right (Helper Box) have vertical layout with 6 rows. If I have naive widget placement as shown on picture 1 Qt is enlarging vertical size of both labels in top row to make height of both QGroupBoxes equal (see red arrows on picture 1).

            This is definitely that I don't want so I've added vertical spacer to the bottom of Summary Box and from the first glance it worked (picture 2). But only from the first glance... What you see is the minimum height of my whole form and the bottom side of spacer and last QCheckBox in the Helper Box seems to be aligned.

            If I'm expanding my form vertically this spacer grows a bit and that causes the increase of height of both top QGroupBoxes. As a result spacing between QCheckBoxes increases too and we can also see that top and bottom spacing are unequal for the top-right box (see red arrows on picture 3).

            I've tried to play with sizeType for my vertical spacer. If I set it to Minimum or MinimumExpanding then the spacer doesn't grow on resize (and doesn't shrink, too) but it appears to be expanded to the size as on picture 3 (corrupting spacings between QCheckBoxes too). If I set it to Maximum, Preferred or Expanding then I observe the same behavior as described above for picture 3.

            What is the proper way to achieve alignment for two QGroupBoxes in a row of grid without affecting spacing between elements (e. g. in that case make vertical spacer to fit only single row of grid layout and never expand/shrink)?



            Answered 2021-Jun-15 at 17:18

            Items will be aligned if both QGroupBoxes have same count of children and each row have at least one child with Expanding vertical policy. Instead of spacer use QWidget

            I removed unrelated widgets and reduces number of rows to 4 for demonstration purposes (less xml).

            Source https://stackoverflow.com/questions/67987476


            QtTest under PyQt5 fails when widgets-under-test have to be visible to work
            Asked 2021-Jun-15 at 17:01

            I've started to create UI tests for my PyQt5 widgets using QtTest but have run into the following difficulties:

            • In order to speed up things, some of my widgets only perform operations when visible. As it seems that QtTest runs with invisible widgets, the corresponding tests fail.

            • For the same reason, I cannot test program logic that makes a subwidget visible under certain conditions.

            Is there a way to make widgets visible during test? Is this good practice (e.g. w.r.t. CI test on GitHub) and is QtTest the way to go?

            I have tried to use pytest with pytest-qt without success as I couldn't find a proper introduction or tutorial and I do know "Test PyQt GUIs with QTest and unittest".

            Below you find a MWE consisting of a widget mwe_qt_widget.MyWidget with a combobox, a pushbutton and a label that gets updated by the other two subwidgets:



            Answered 2021-Jun-15 at 17:01

            The problem is simple: QWidgets are hidden by default so isVisible() will return false, the solution is to invoke the show() method in init() to make it visible:

            Source https://stackoverflow.com/questions/67990408


            How to get a return value in PyQt5?
            Asked 2021-Jun-15 at 16:49

            How to get the return value? Attach my code. My intention: Want to check the QListWidget and if it's empty, a message Box popup will raise and ask the option from the user. Problem: At the stage of beginning itself, a Message box popup will display, (I don't want it at the beginning stage), If the QListwidget is empty then the MessageBox popup will display as desired, and if we select "Yes" or " No" Button, Nothing will return/print in the first file. How to resolve?




            Answered 2021-Jun-15 at 16:49

            In first it is not necessary to make the verification be done in a new class, it is also logical that you invoke func_create_newitem since as you point out that method must be invoked when the item was not found.

            Source https://stackoverflow.com/questions/67989712


            How to handle TLS handshake timeout in QTcpServer?
            Asked 2021-Jun-15 at 10:02

            I'm trying to figure out how to create a timeout for the handshake process in a TLS connection in a QTcpServer.

            I tried something like this in the overriden incomingConnection function:



            Answered 2021-Jun-15 at 10:02

            I ended implementing the TLS handshake timeout this way:

            Source https://stackoverflow.com/questions/67838190


            How to create an invalid QModelIndex?
            Asked 2021-Jun-15 at 07:36

            I am implementing a function which searchs a QModelIndex based on a QString input. However if I cannot find this index, the function should retun an invalid index. My model is a QStandardItemModel.

            Is is okay to return invisibleRootItem()->index() as an invalid index? In the qt documentation is noted that it will always creates an invalid index.



            Answered 2021-Jun-15 at 07:36

            You must use the default constructor of QModelIndex(e.g. return QModelIndex()) which is null as indicated in the docs:

            Creates a new empty model index. This type of model index is used to indicate that the position in the model is invalid.

            (emphasis mine)

            Source https://stackoverflow.com/questions/67981912


            How to add an image to QGraphicsScene so rectangle items can be located on it?
            Asked 2021-Jun-14 at 18:46

            I have a python code that I can add multiple rectangles on a QGraphicsScene.



            Answered 2021-Jun-14 at 18:46

            There are several options:

            • setBackgroundBrush():

            Source https://stackoverflow.com/questions/67975449


            Width, Height, and Margin doesn't work in QT Style Sheet in PySide6
            Asked 2021-Jun-14 at 17:26

            So I have a Qt StyleSheet called main.qss in the style sheet I am trying to set width and height it doesn't work it just remains the same. This same thing happens for Margins aswell.

            Here is the QSS:



            Answered 2021-Jun-14 at 17:07

            Your stylesheet doesn't work for two reasons:

            1. the width (and height) properties generally don't apply to widgets, but only to subcontrols, as explained in the docs:

            Warning: Unless otherwise specified, this property has no effect when set on widgets. If you want a widget with a fixed width, set the min-width and max-width to the same value.

            1. the "dot" separator doesn't work as it does in python, but as it does in css: it's a class selector:

            .QPushButton          Matches instances of QPushButton, but not of its subclasses.

            If you want to match the objectName property, you need the ID selector:

            Source https://stackoverflow.com/questions/67974053


            PYQT5: some key presses not registering with keyPressEvent
            Asked 2021-Jun-14 at 17:19

            What my code is about: I'm currently working on a project to create an image browser for all the images I have in my PC. I have created a database of all the images, this app will give me the ability to search through the database to find, and view and cycle through the images.

            What my problem is: I'm trying to read left and right arrow key presses and connect them to a function that will change the shown image to the previous or next image in sequence. But for some reason the first two left-arrow presses don't register and none of the right-arrow presses register. Also, no other key presses are registering. My guess is that this is happening because the arrow keys are cycling through the widgets on screen. Need ideas on how I can fix this.



            Answered 2021-Jun-14 at 17:19

            The main problem is that you're adding widgets that can get focus, while the "viewer" doesn't have a focus, nor it can accept one by keyboard/mouse if not programmatically.

            The result is that when the window is shown the first time, Qt will try to set the focus on the widget that can accept one within the central widget, but since there's none, any keyboard event is ignored. Whenever you try to use the arrow keys, then, Qt will use the "keyboard navigation" mode, and will find the first widget that can accept focus (the "search" button, if you go left), making the event accepted, and thus not propagated to the main window; going further, if you go left once more, the "tags" combo will get focused, again accepted and not propagated.

            A temporary workaround could be to ensure that the buttons and line edit only get focus by clicking (but buttons should probably not get focus at all):

            Source https://stackoverflow.com/questions/67971292


            How to set proper path to offline OSM directory in QML ( not using qrc )?
            Asked 2021-Jun-14 at 12:04

            I would like to have folder with tiles realTiles in folder with .exe.

            Of course I can add folder to qrc and everything is ok:



            Answered 2021-Jun-14 at 12:04

            Try to give the full path

            Source https://stackoverflow.com/questions/67961689

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network


            No vulnerabilities reported

            Install Qt

            You can download it from GitHub.


            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
          • HTTPS


          • CLI

            gh repo clone lesliefish/Qt

          • sshUrl


          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link