Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.8k Posts
  • How to change selected row height in QListView

    Unsolved
    9
    0 Votes
    9 Posts
    3k Views
    qwasder85Q
    @Binary-Soft YourListView->setStyleSheet(QString("::item:selected { height: %1; }").arg(new_height)); ... I know, the topic is old. But just to keep future devs from spending too much time on something like this.
  • QSqlTableModel Filter

    Unsolved qsqltablemodel filter
    4
    0 Votes
    4 Posts
    1k Views
    Pl45m4P
    @JonB said in QSqlTableModel Filter: 'First name' LIKE '%Jacob%' lol, was checking the condition and haven't noticed that, because of the use of DataBase::COLUMN_FIRSTNAME
  • Controlling size of a dock widget

    Unsolved
    20
    0 Votes
    20 Posts
    3k Views
    PerdrixP
    @SGaist With no saved state/geometry, window opens with lower dock widget at 150 high. Then sized window and made dock widget large 00000033 2023/02/10 09:55:35.275 021380 00004e20 >Restoring Window State and Position (nothing to see here) 00000044 2023/02/10 09:56:29.013 021380 00004e20 >Saving Window State and Position 00000045 2023/02/10 09:56:29.013 021380 00004e20 >Hex dump of geometry: 00000046 2023/02/10 09:56:29.013 021380 00004e20 >000000000794A8D0: 01D9D0CB 00030000 000004C0 00000137 ...............7 00000047 2023/02/10 09:56:29.013 021380 00004e20 >000000000794A8E0: 0000083A 000004E6 000004C0 00000155 ...:...........U 00000048 2023/02/10 09:56:29.013 021380 00004e20 >000000000794A8F0: 0000083A 000004E6 00000000 00000000 ...:............ 00000049 2023/02/10 09:56:29.014 021380 00004e20 >000000000794A900: 0C000000 04C00000 01550000 083A0000 .........U...:.. 00000050 2023/02/10 09:56:29.014 021380 00004e20 >000000000794A910: 04E6 .. 00000051 2023/02/10 09:56:29.014 021380 00004e20 >Hex dump of windowState: 00000052 2023/02/10 09:56:29.014 021380 00004e20 >00000000079E9E60: 000000FF 00000000 FD000000 02000000 ................ 00000053 2023/02/10 09:56:29.014 021380 00004e20 >00000000079E9E70: 00000001 04000003 7CFC0200 000001FB ........|....... 00000054 2023/02/10 09:56:29.014 021380 00004e20 >00000000079E9E80: 00000016 00450078 0070006C 006F0072 .....E.x.p.l.o.r 00000055 2023/02/10 09:56:29.014 021380 00004e20 >00000000079E9E90: 00650072 00420061 00720100 00000000 .e.r.B.a.r...... 00000056 2023/02/10 09:56:29.015 021380 00004e20 >00000000079E9EA0: 00037C00 0001C600 07FFFF00 00000300 ..|............. 00000057 2023/02/10 09:56:29.015 021380 00004e20 >00000000079E9EB0: 00027100 000218FC 01000000 01FB0000 ..q............. 00000058 2023/02/10 09:56:29.015 021380 00004e20 >00000000079E9EC0: 00160050 00690063 00740075 00720065 ...P.i.c.t.u.r.e 00000059 2023/02/10 09:56:29.015 021380 00004e20 >00000000079E9ED0: 004C0069 00730074 01000001 0A000002 .L.i.s.t........ 00000060 2023/02/10 09:56:29.015 021380 00004e20 >00000000079E9EE0: 71000002 7100FFFF FF000002 71000001 q...q.......q... 00000061 2023/02/10 09:56:29.015 021380 00004e20 >00000000079E9EF0: 5E000000 01000000 04000000 01000000 ^............... 00000062 2023/02/10 09:56:29.015 021380 00004e20 >00000000079E9F00: 08FC0000 0000 ...... Opened with the state saved above and then shrank the dock widget area 00000033 2023/02/10 09:56:34.098 020684 000061f8 >Restoring Window State and Position 00000034 2023/02/10 09:56:34.098 020684 000061f8 >Hex dump of geometry: 00000035 2023/02/10 09:56:34.098 020684 000061f8 >0000000003128A30: 01D9D0CB 00030000 000004C0 00000137 ...............7 00000036 2023/02/10 09:56:34.098 020684 000061f8 >0000000003128A40: 0000083A 000004E6 000004C0 00000155 ...:...........U 00000037 2023/02/10 09:56:34.098 020684 000061f8 >0000000003128A50: 0000083A 000004E6 00000000 00000000 ...:............ 00000038 2023/02/10 09:56:34.098 020684 000061f8 >0000000003128A60: 0C000000 04C00000 01550000 083A0000 .........U...:.. 00000039 2023/02/10 09:56:34.099 020684 000061f8 >0000000003128A70: 04E6 .. 00000040 2023/02/10 09:56:34.099 020684 000061f8 >Hex dump of windowState: 00000041 2023/02/10 09:56:34.099 020684 000061f8 >000000000310CAF0: 000000FF 00000000 FD000000 02000000 ................ 00000042 2023/02/10 09:56:34.099 020684 000061f8 >000000000310CB00: 00000001 04000003 7CFC0200 000001FB ........|....... 00000043 2023/02/10 09:56:34.099 020684 000061f8 >000000000310CB10: 00000016 00450078 0070006C 006F0072 .....E.x.p.l.o.r 00000044 2023/02/10 09:56:34.099 020684 000061f8 >000000000310CB20: 00650072 00420061 00720100 00000000 .e.r.B.a.r...... 00000045 2023/02/10 09:56:34.099 020684 000061f8 >000000000310CB30: 00037C00 0001C600 07FFFF00 00000300 ..|............. 00000046 2023/02/10 09:56:34.099 020684 000061f8 >000000000310CB40: 00027100 000218FC 01000000 01FB0000 ..q............. 00000047 2023/02/10 09:56:34.099 020684 000061f8 >000000000310CB50: 00160050 00690063 00740075 00720065 ...P.i.c.t.u.r.e 00000048 2023/02/10 09:56:34.100 020684 000061f8 >000000000310CB60: 004C0069 00730074 01000001 0A000002 .L.i.s.t........ 00000049 2023/02/10 09:56:34.100 020684 000061f8 >000000000310CB70: 71000002 7100FFFF FF000002 71000001 q...q.......q... 00000050 2023/02/10 09:56:34.100 020684 000061f8 >000000000310CB80: 5E000000 01000000 04000000 01000000 ^............... 00000051 2023/02/10 09:56:34.100 020684 000061f8 >000000000310CB90: 08FC0000 0000 ...... ... 00000058 2023/02/10 09:56:43.635 020684 000061f8 >Saving Window State and Position 00000059 2023/02/10 09:56:43.635 020684 000061f8 >Hex dump of geometry: 00000060 2023/02/10 09:56:43.635 020684 000061f8 >00000000079C8A10: 01D9D0CB 00030000 000004C0 00000137 ...............7 00000061 2023/02/10 09:56:43.635 020684 000061f8 >00000000079C8A20: 0000083A 000004E6 000004C0 00000155 ...:...........U 00000062 2023/02/10 09:56:43.636 020684 000061f8 >00000000079C8A30: 0000083A 000004E6 00000000 00000000 ...:............ 00000063 2023/02/10 09:56:43.636 020684 000061f8 >00000000079C8A40: 0C000000 04C00000 01550000 083A0000 .........U...:.. 00000064 2023/02/10 09:56:43.636 020684 000061f8 >00000000079C8A50: 04E6 .. 00000065 2023/02/10 09:56:43.636 020684 000061f8 >Hex dump of windowState: 00000066 2023/02/10 09:56:43.636 020684 000061f8 >0000000007A32520: 000000FF 00000000 FD000000 02000000 ................ 00000067 2023/02/10 09:56:43.636 020684 000061f8 >0000000007A32530: 00000001 04000003 7CFC0200 000001FB ........|....... 00000068 2023/02/10 09:56:43.636 020684 000061f8 >0000000007A32540: 00000016 00450078 0070006C 006F0072 .....E.x.p.l.o.r 00000069 2023/02/10 09:56:43.637 020684 000061f8 >0000000007A32550: 00650072 00420061 00720100 00000000 .e.r.B.a.r...... 00000070 2023/02/10 09:56:43.637 020684 000061f8 >0000000007A32560: 00037C00 0001C600 07FFFF00 00000300 ..|............. 00000071 2023/02/10 09:56:43.637 020684 000061f8 >0000000007A32570: 00027100 000110FC 01000000 01FB0000 ..q............. 00000072 2023/02/10 09:56:43.637 020684 000061f8 >0000000007A32580: 00160050 00690063 00740075 00720065 ...P.i.c.t.u.r.e 00000073 2023/02/10 09:56:43.637 020684 000061f8 >0000000007A32590: 004C0069 00730074 01000001 0A000002 .L.i.s.t........ 00000074 2023/02/10 09:56:43.637 020684 000061f8 >0000000007A325A0: 71000002 7100FFFF FF000002 71000002 q...q.......q... 00000075 2023/02/10 09:56:43.637 020684 000061f8 >0000000007A325B0: 66000000 01000000 04000000 01000000 f............... 00000076 2023/02/10 09:56:43.637 020684 000061f8 >0000000007A325C0: 08FC0000 0000 ...... Opened again - but dock widget area still came up large . 00000033 2023/02/10 09:57:01.941 020816 000048cc >Restoring Window State and Position 00000034 2023/02/10 09:57:01.941 020816 000048cc >Hex dump of geometry: 00000035 2023/02/10 09:57:01.941 020816 000048cc >0000000002FB3200: 01D9D0CB 00030000 000004C0 00000137 ...............7 00000036 2023/02/10 09:57:01.941 020816 000048cc >0000000002FB3210: 0000083A 000004E6 000004C0 00000155 ...:...........U 00000037 2023/02/10 09:57:01.941 020816 000048cc >0000000002FB3220: 0000083A 000004E6 00000000 00000000 ...:............ 00000038 2023/02/10 09:57:01.941 020816 000048cc >0000000002FB3230: 0C000000 04C00000 01550000 083A0000 .........U...:.. 00000039 2023/02/10 09:57:01.942 020816 000048cc >0000000002FB3240: 04E6 .. 00000040 2023/02/10 09:57:01.942 020816 000048cc >Hex dump of windowState: 00000041 2023/02/10 09:57:01.942 020816 000048cc >0000000003075CB0: 000000FF 00000000 FD000000 02000000 ................ 00000042 2023/02/10 09:57:01.942 020816 000048cc >0000000003075CC0: 00000001 04000003 7CFC0200 000001FB ........|....... 00000043 2023/02/10 09:57:01.942 020816 000048cc >0000000003075CD0: 00000016 00450078 0070006C 006F0072 .....E.x.p.l.o.r 00000044 2023/02/10 09:57:01.942 020816 000048cc >0000000003075CE0: 00650072 00420061 00720100 00000000 .e.r.B.a.r...... 00000045 2023/02/10 09:57:01.942 020816 000048cc >0000000003075CF0: 00037C00 0001C600 07FFFF00 00000300 ..|............. 00000046 2023/02/10 09:57:01.942 020816 000048cc >0000000003075D00: 00027100 000110FC 01000000 01FB0000 ..q............. 00000047 2023/02/10 09:57:01.943 020816 000048cc >0000000003075D10: 00160050 00690063 00740075 00720065 ...P.i.c.t.u.r.e 00000048 2023/02/10 09:57:01.943 020816 000048cc >0000000003075D20: 004C0069 00730074 01000001 0A000002 .L.i.s.t........ 00000049 2023/02/10 09:57:01.943 020816 000048cc >0000000003075D30: 71000002 7100FFFF FF000002 71000002 q...q.......q... 00000050 2023/02/10 09:57:01.943 020816 000048cc >0000000003075D40: 66000000 01000000 04000000 01000000 f............... 00000051 2023/02/10 09:57:01.943 020816 000048cc >0000000003075D50: 08FC0000 0000 ......
  • Qt Downloader only gives commercial option

    Unsolved installation open source
    22
    0 Votes
    22 Posts
    8k Views
    Christian EhrlicherC
    Please take a lok if the 'Next' button is really grayed out - I also got a red warning and did not notice that the 'Next' button is available.
  • This topic is deleted!

    Unsolved
    3
    0 Votes
    3 Posts
    7 Views
  • How to create a QTreeView that can handle very large amount of data?

    Unsolved
    3
    0 Votes
    3 Posts
    1k Views
    jeremy_kJ
    @Daniella said in How to create a QTreeView that can handle very large amount of data?: I'm adding data loaded form a file on disk to a QTreeView , the file contains more than 60.000 rows and new 'rows'/data will be constantly added to it while its being executed, so each time the GUI is reloaded/reopened the file will contain more data. Is 60.000 records a lot of data to hold in memory? 60k integers is probably not a big deal for a currently produced desktop or smartphone level device. 60k 4K HDR movies is a different story. I tried to load this data using another thread just to figure out that QAbstractItemModel is not thread safe. Then I tried to created a 'lazy load' subclass of a QAbstractItemModel , that 'process' the items as they get visible in the QTreeview. At the beginning it worked great, as it doesn't freeze the entire GUI for like 10~ seconds at runtime anymore. However when i scroll the QTreeView it get frozen for many seconds, i think its 'loading' the data. Profile the execution. Otherwise you're likely engaging (and asking us to engage) in premature optimization. I was reading the documentation of QAbstractItemModel and see that it have these two functions: fetchMore() and canFetchMore(), to control how the data is loaded, but i didn't understand how to use it and if they could help in this case. The view calls these in situations where more data might be useful. Look at them as an opportunity to queue asynchronous loading. if (view.scrollBar.value() == view.scrollBar.maximum()) if (canFetchMore()) fetchMore(); ... struct Model: public QAbstractItemModel { int pageCount; int pagesLoaded; QNetworkManager netman; Model() { connect(&netman, &QNetworkManager::finished, this, &Model::addData); } bool canFetchMore(QModelIndex &parent) { return pageCount > pagesLoaded; } void fetchMore(QModelIndex &parent) { if (pageCount > pagesLoaded) netman.get(QUrl(...)); } }; How I could dynamically load/unload the data as it get visible in the QTreeView? and free the memory of the rows that are not visible/not visible anymore, instead of having the entire file loaded into the memory. QAbstractItemView::indexAt() can help answer this question, but be careful. If the user scrolls and the view attempts to display what it thinks is available data, the model will need to either block in QAbstractItemModel::data() while retrieving it, or present dummy data to later be corrected with QAbstractItemMode::dataChanged(). Is unloading necessary? void addData(const QVector<QStringList> &row_info) { beginInsertRows(QModelIndex(), m_rows.count(), m_rows.count() + row_info.count() - 1); for (const auto &row : row_info) m_rows.append(row); endInsertRows(); } Engaging in a little premature optimization, consider QList::append(QList&&) or QList::append::(QList &) instead of a for loop picking apart the list.
  • This topic is deleted!

    Unsolved
    2
    0 Votes
    2 Posts
    13 Views
  • Log Window Not Showing!

    Unsolved
    7
    0 Votes
    7 Posts
    378 Views
    Aviral 0A
    @JonB @jsulm after debugging i got to know that QFile was not reading file, got it solved and not its working perfectly. Thankyou for all you help and kind support.
  • Qt Web3 Support

    Unsolved
    2
    0 Votes
    2 Posts
    397 Views
    C
    @NullByte I assume by "Web3" you mean the Ethereum blockchain-related APIs. There's no mention of any C++ support on their [developer pages](https://ethereum.org/en/developers/local-environment/ (only JavaScript, Java, Rust and Python). I guess if you go the Python route you might have options that include Qt.
  • QtCreator best CMake/Conan workflow?

    Solved
    3
    0 Votes
    3 Posts
    2k Views
    R
    @cristian-adam Thank you
  • 0 Votes
    21 Posts
    6k Views
    H
    @LRDPRDX In terminal, "double free or corruption (out)" message is printed after the destructor has been called. Update: Sorry for bothering you. I was having similar issue. I saw your post in stackoverflow and then my problem solved when I allocated my QMainWindow object in heap instead of the stack. Many thanks!
  • Child widget hides when mouse events are triggered?

    Unsolved
    3
    0 Votes
    3 Posts
    325 Views
    JonBJ
    @Calicoder When you create the AppChildWidget from AppMain do you indeed pass it this for its parent? Otherwise please answer @dheerendra's questions.
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    84 Views
    No one has replied
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    5 Views
    No one has replied
  • hi Please me out

    Unsolved
    3
    0 Votes
    3 Posts
    319 Views
    JoeCFDJ
    @Mantu for full screen: QRect rec = QGuiApplication::screens().at( 0 )->geometry(); your_window->resize( QSize( rec.width(), rec.height() ) ); If it is what you need, it still can not solve your issue while you may need to scale other widgets. And this can be tricky.
  • Class contains Q_OBJECT macro error ?

    Moved Unsolved
    2
    0 Votes
    2 Posts
    790 Views
    Christian EhrlicherC
    @AnneRanch said in Class contains Q_OBJECT macro error ?: Class contains Q_OBJECT macro but does not inherit from QObject This error message tells you exactly where the problem is - you added Q_OBJECT but do not derive from QObject.
  • The program I created closes when data comes

    Solved
    6
    0 Votes
    6 Posts
    469 Views
    serkan_trS
    @jsulm So do I have a chance to make it easier to use? In the project, I send the values ​​from the serialqml.cpp file with the help of ROS and receive it with rosqml.cpp and send it to the qml file.With qml, serialqml.cpp and qml file are in the same place. Can I directly link the values ​​from serialqml.cpp to this qml file or do I have to link it with the c++ side?
  • SUBDIRS and #include ? (question)

    Unsolved
    1
    0 Votes
    1 Posts
    211 Views
    No one has replied
  • perl needs to be available to build qt

    Unsolved
    10
    0 Votes
    10 Posts
    731 Views
    jsulmJ
    @inusion I think you should run cmake in the examples folder or in examples/serialbus Please read this part again.
  • Adding individual bytes to message for serial port

    Solved
    2
    0 Votes
    2 Posts
    274 Views
    jsulmJ
    @agmar said in Adding individual bytes to message for serial port: quint8 message = 0xFF; If you need an array then use one: QByteArray message; message.append(0xFF); ... m_serial->write(message);