Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.5k Posts
  • 0 Votes
    3 Posts
    249 Views
    L
    Oh yes, thank you. That was a total thinking failure. What I actually wanted to test was something like that: { Nix nix4(4, "Hello, I'm four"); *nix1 = nix4; } qWarning() << "nix1: " << nix1->display(4); And that works. *nix2 = *nix1; delete nix1 works too Thanks, solved!
  • Is there a canonical way to set up QApplication and Google Test together?

    Unsolved
    5
    0 Votes
    5 Posts
    4k Views
    R
    @shavera said in Is there a canonical way to set up QApplication and Google Test together?: After many iterations, I've finally found what I think works well here: int main(int argc, char *argv[]) { QCoreApplication app{argc, argv}; QTimer::singleShot(0, [&]() { ::testing::InitGoogleTest(&argc, argv); auto testResult = RUN_ALL_TESTS(); app.exit(testResult); }); return app.exec(); } it works for me
  • Qt warning of type conversion already registered

    4
    0 Votes
    4 Posts
    2k Views
    C
    @nyaruko said in Qt warning of type conversion already registered: I have a multi-thread Qt program... This is a common cause of issues of all flavours. It may be as simple as the same setup code for shared configuration, e.g. the metatype database, executing in multiple threads. @ocgltd said in Qt warning of type conversion already registered: Any way to track this down? You could provide a minimal program that invokes the message, some basic Qt version information, tool chain information, etc. Something that happens twice in ten years here and spans many Qt versions is not likely to have an immediate, "I've seen that before," response.
  • drawPrimitive does not draw over all primitive elements

    Unsolved
    5
    0 Votes
    5 Posts
    327 Views
    A
    @Christian-Ehrlicher Thank you, I figured it out, using opt->rect's x and y attributes draws it in the correct place.
  • Unit Testing with multiple .cpp files

    Unsolved
    8
    0 Votes
    8 Posts
    903 Views
    SGaistS
    You are not linking against the library you are testing.
  • mac style: merged title bar and content area?

    Solved
    9
    1 Votes
    9 Posts
    1k Views
    D
    workaround: Add Qt::NoTitleBarBackgroundHint window flag
  • qt-v6.5.4-lts-lgpl cross compile for windows

    Unsolved
    1
    0 Votes
    1 Posts
    164 Views
    No one has replied
  • QComboBox styling is not dyamic

    Unsolved
    3
    0 Votes
    3 Posts
    263 Views
    O
    @SGaist I am on windows.
  • 0 Votes
    10 Posts
    784 Views
    JonBJ
    @Mark81 It is "difficult" because you do not have a proper foreign key relation, which is what QSqlRelationalTableModel requires. Having some other column (eventType) whose value dictates which of multiple tables (alarms, sessions, ...) is the foreign one in which to look up the key column's value is supported neither in SQL nor Qt's QSqlRelationalTableModel --- it is not allowed in the definition of a foreign key. Either think about redefining/rearchitecting your intended relationships which fits better with SQL or (in my opinion) give up trying to use QSqlRelationalTableModel. Instead read in the contents of all required/linked tables into their own normal QSqlTableModels, as well as the original "source" table, and implement your desired logic yourself in client code as required for your desired behaviour.
  • how to set the style when the mouse hovered on the whole row of the tablewidget object?

    Unsolved
    2
    0 Votes
    2 Posts
    274 Views
    Pl45m4P
    @nicker-player Set a stylesheet?!
  • Diffie-Hellman key exchange method in qt

    Solved
    10
    0 Votes
    10 Posts
    1k Views
    Christian EhrlicherC
    I still don't see any relation to Qt here. We already told you more than once where you can get such random numbers from. Qt does not provide such things (not needed and to hard to implement it properly - there are enough good alternatives around)
  • How to prevent checkbox text from overlapping when multiple checkboxes in QHBoxLayout?

    Unsolved
    5
    0 Votes
    5 Posts
    477 Views
    R
    @Pl45m4 What setup are you using? MacOS 15.1 Apple clang Qt 6.7 QApplication::font() returns QFont(.AppleSystemUIFont,13,-1,5,400,0,0,0,0,0,0,0,0,0,0,1).
  • std::thread crash on ubuntu 20.04

    Unsolved
    3
    0 Votes
    3 Posts
    280 Views
    JonBJ
    @PPatel said in std::thread crash on ubuntu 20.04: statement std::thread t1(this). In addition to @SGaist suggestion, what is this here? Does it have anything to do with Qt? I am not a std::thread user but I must confess I do not understand which of its constructor overloads you are even invoking here (unless your this is an existing std::thread).
  • Continuation not working with QtConcurrent::mapped

    Unsolved
    20
    1 Votes
    20 Posts
    2k Views
    A
    Bug posted as https://bugreports.qt.io/browse/QTBUG-133522
  • Qt application is not loading your custom resources from resources.qrc

    Solved
    5
    0 Votes
    5 Posts
    553 Views
    P
    @Christian-Ehrlicher Thanks Christian!
  • Code review: multiple checkboxes as QStyledItemDelegate

    9
    0 Votes
    9 Posts
    840 Views
    M
    @Christian-Ehrlicher I did. From what I understand it seems it run the code you highlighted before: [image: a224c421-8a50-4f97-acaf-76e810198b8d.png] but still no focus rect: [image: f3dd347b-9bfb-4294-ac34-9be208037db9.png] To further digging the issue I placed a QCheckBox on a form and I managed to make the focus rect appeared: [image: 889e0be2-00b8-4887-ad51-a9a69c53d13c.png] then I placed a breakpoint to inspect the properties of the state variable: QStyle::State_Enabled | QStyle::State_On | QStyle::State_HasFocus | QStyle::State_Active | QStyle::State_KeyboardFocusChange and as I've done before, I added them to my delegate: if (isChecked) opt.state.setFlag(QStyle::State_On); else opt.state.setFlag(QStyle::State_Off); if (_wdPress == i) opt.state.setFlag(QStyle::State_Sunken); opt.state.setFlag(QStyle::State_Enabled); opt.state.setFlag(QStyle::State_HasFocus); opt.state.setFlag(QStyle::State_Active); opt.state.setFlag(QStyle::State_KeyboardFocusChange); and now it works. But it works even removing the Enabled and Active state. And I clearly tried these flags before, as I wrote above. I have no time to reinstall Qt 6.8.1 to test again, but it seems something has changed in 6.8.2.
  • Project configuration failed on linux

    Unsolved
    2
    0 Votes
    2 Posts
    144 Views
    SGaistS
    Hi and welcome to devnet, How did you install Qt ? Do you have cmake installed ?
  • Include Qt6 libs in CMake project on macOS

    Unsolved
    2
    0 Votes
    2 Posts
    314 Views
    jsulmJ
    @developer23 said in Include Qt6 libs in CMake project on macOS: In CMake I include Headers and nested folders and then compiler emit This sounds wrong. You should only tell CMake which Qt modules you need, like: find_package(Qt6 REQUIRED COMPONENTS Core) target_link_libraries(mytarget PRIVATE Qt6::Core) Also, there is no need to have module names in includes: #include <QChar>
  • Bug in qt apps with colemak layout.

    Unsolved
    3
    0 Votes
    3 Posts
    437 Views
    N
    @jsulm Yes, as mentioned in the link.
  • QSqlTableModel setFilter => Unable to execute statement

    Solved qsqltablemodel qsqldatabase
    8
    0 Votes
    8 Posts
    798 Views
    Pl45m4P
    @JonB said in QSqlTableModel setFilter => Unable to execute statement: ? Escaping the column names and doing everything more thoughtfully would have prevented the crash... so "range" instead of range etc... I think not only any select statements were influenced but the whole table itself. That's why the DHCP service didn't start up anymore ;)