Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.3k Topics 455.6k Posts
  • This topic is deleted!

    Unsolved 8 Jun 2020, 12:56
    0 Votes
    1 Posts
    7 Views
    No one has replied
  • Unable to set path for QSettings generated config file

    Unsolved 3 Jun 2020, 21:51
    0 Votes
    8 Posts
    1k Views
    @PusRob Are you sure? I've tried in my Ubuntu. I copied your code from the top post, only changed one line: QSettings::setPath(QSettings::defaultFormat(), QSettings::UserScope, "/tmp"); And the output is "/tmp/MyAppOrg/MyApp.conf"
  • QIntValidator for unsigned long values

    Solved 8 Jun 2020, 10:46
    0 Votes
    6 Posts
    2k Views
    @VRonin I can't express how grateful I am for this. I think there's a typo in the validate function (the condition of the third if statement should be numInput > m_max), but otherwise it worked. Thanks!
  • 0 Votes
    7 Posts
    1k Views
    I did the migration with mysqldump then I edited the dump file. Then I have the resulting file into sqlite and saved it as database. The date columns are now stored in sqlite as TEXT fields. All done on a linux machine. Thank you VRonin for your suggestion. That sounds like a great idea. Can I do this in pyQt5 or do I need to go to C++? I think QSQLiteDriver is a plugin i.e. a shared library. That means I have to do this in C++. Is that right? I wanted to avoid C++ so that my application is more portable. But anyway this solution sounds great. Thanks for you answers guys.
  • QLable Data format nice looking

    Solved 5 Jun 2020, 17:29
    0 Votes
    4 Posts
    267 Views
    the second solution is better for me because my string contain chars in "abc" and must have a constant position. Thank you @Pl45m4 , thank you @SGaist
  • QWidget:: close button hint

    7 Dec 2011, 17:16
    0 Votes
    11 Posts
    11k Views
    @Poonam15 You can, but this was not the OP's question from 2011, he wanted a window to have a close button on its title bar.
  • error: LNK1120: 1 unresolved externals

    Solved 7 Jun 2020, 10:31
    0 Votes
    6 Posts
    693 Views
    @Engelard said in error: LNK1120: 1 unresolved externals: Such bugs of this framework makes me sad. I for the whole day was thinking what's wrong with me... Its not a bug in a technical sense. But it would be nice if qmake would recreate ALL of the make file when you change the .pro file or at least ask.
  • 0 Votes
    3 Posts
    376 Views
    @JonB So embarrassing. As usual, I was too blind to see that the error code argument was changed from int to QString. Thank you....!
  • QListWidget index of last inserted row

    Solved 7 Jun 2020, 12:44
    0 Votes
    6 Posts
    930 Views
    @Christian-Ehrlicher You mean that in future versions, QListWidget may handle this in a different way so it may for example return an invalid or wrong row index for example? So you'd recommend to bether stop sorting for the moment of interaction? As I can't see any disadvantages, I think I'll do that and stop/restart sorting while inserting the row.
  • Qt::Popup window behaviour

    Solved 5 Jun 2020, 15:43
    0 Votes
    10 Posts
    5k Views
    STOP PRESS [Including for @SGaist, @mrjj's attention.] I revisited my 10 line program apparently showing leak on plain new QWidget but not on new QWidget; setWindowFlags(Qt::Popup);. If I remove the "test" non-Popup widget and only have the Popup widget then valgrind does report the Popup as a leak. If I reverse the order so that the Popup widget is new-ed first and the non-Popup is new-ed next, then valgrind does report the Popup widget as leaking but the non-Popup widget is not reported as leaking. For whatever reason, this reveals that valgrind sometimes only reports certain leaks but not others [has anyone else encountered this behaviour?]. This is "disappointing", but at least makes sense, showing nothing special about Popup. So going back to @mrjj's situation. I do not leak because my Popup widget is on the stack. In his situation he news on the heap, and I conclude that he does need to delete the Popup window. Problem #1 at least apparently resolved!
  • How to propagate/limit stylesheets through code

    Unsolved 7 Jun 2020, 17:09
    0 Votes
    4 Posts
    730 Views
    @Taytoo said in How to propagate/limit stylesheets through code: It's not doing anything special, just setting stylesheet for QDialog and nowhere else. Then in principle if it works from Designer-generated code you should be able to make it work in manual code? Defining custom classes gets too tricky e.g. with QStackedWidget and QTabWidget, I tried specifying a custom class but for some reason the style just wasn't applying I can only say that I do not find this. I do use custom classes when necessary, and it works for me. If I want to apply stylesheet rules across a variety of elements, I use the "dynamic class" principle described at https://doc.qt.io/Qt-5/stylesheet-syntax.html#selector-types Property Selector & https://doc.qt.io/Qt-5/stylesheet-examples.html#customizing-using-dynamic-properties. I use this against a dynamic class property, so I can have things like: /* stylesheet */ .backgroundColorTransparent { background-color: transparent; } /* code */ widget.setProperty("class", "backgroundColorTransparent"); I can't recall now, but I think you can associate multiple classes with a widget as a space-separated list on the class property. One other thought: if your only problem is with *background color", have a read of https://forum.qt.io/topic/115640/how-to-see-the-area-detected-by-qmouseevent/9.
  • Widget background color at runtime

    Solved 31 Mar 2020, 08:25
    0 Votes
    4 Posts
    1k Views
    @J-Hilk Dear @J-Hilk, At the time I accepted your suggestion that my problem was a Qt 5.12.2 issue, as per the bug report. I worked around it by setting the color on the conveniently-available parent widget. However, I now discover that my problem is as per my post at https://forum.qt.io/topic/115640/how-to-see-the-area-detected-by-qmouseevent/9, i.e. I need to add: myDerivedWidget->setAttribute(Qt::WA_StyledBackground, true); and then the background color works at run-time. Your bug report may well apply, but I don't think it's my case here. I trust you will understand if I now mark this post as the solution to my issue here!
  • How to see the area detected by QMouseEvent

    Unsolved 7 Jun 2020, 10:43
    0 Votes
    9 Posts
    839 Views
    @Bonnie, @luciole Well blow me down! This is indeed the problem/solution in my own code! Please see my recent report of this issue in https://forum.qt.io/topic/113109/widget-background-color-at-runtime. There I have a QWidget-derived class, whose background I wish to set, which is the child widget of a QMdiSubWindow. It worked in Designer but not at runtime. At the time I accepted @J-Hilk's reply at https://forum.qt.io/topic/113109/widget-background-color-at-runtime/2 thats a bug in Qt, you have 3 options: upgrade to 5.12.6/7 only set stylesheets in designer only set stylesheets in code Edit: found the related bug report: https://bugreports.qt.io/browse/QTBUG-79545 Maybe there is a Qt 5.12.2 issue, but it does not seem to be my case. Until now I had "solved" this by placing colored background not on my subclassed widget but instead on its parent, which is a QMdiSubWindow. Instead, I now find that all I have to do is add myDerivedWidget->setAttribute(Qt::WA_StyledBackground, true); and the background color works at run-time! FWIW, I tested and I do not have to have the Q_OBJECT macro on the derived class to make this work, though it does no harm. I do have to set the attribute.
  • Implementation Singleton problem

    Unsolved 7 Jun 2020, 21:37
    0 Votes
    2 Posts
    322 Views
    You're missing a definition of your static variable. Put that in your .cpp file: SMessenger* SMessenger::instance_ = nullptr; Btw. don't forget to delete your singleton before your application object is destroyed. No QObject should live longer than that. One way to do it is to connect QApplication::aboutToQuit signal to your singleton's deleteLater slot when you're creating it. Btw.2 Don't use NULL. It's an old C style macro. If you need to be that explicit use nullptr or you could just assert(instance_).
  • ClipPlane in qml

    Unsolved 7 Jun 2020, 21:42
    0 Votes
    1 Posts
    102 Views
    No one has replied
  • Focus ring around tree/table views?

    Unsolved 7 Aug 2019, 23:14
    0 Votes
    33 Posts
    4k Views
    I've updated the example project so you can test six different implementations of "focus ring", none of which are 100% successful. The only one that comes close is kTest_PARENT_STYLE, and only on mac. On windows i can't for the LIFE of me make ANY focus ring bigger than 1 pixel, which is just too small. I really need 3 pixels in order to keep the UI appearing the same as the previous (10 year old, 32bit) app. -dave
  • PyQt5 QSetting doesn't save information

    Unsolved 7 Jun 2020, 16:26
    0 Votes
    9 Posts
    960 Views
    well. have no idea what the problem it is. recorded the video - https://youtu.be/60Gf27affeM @SGaist
  • QHelpEngineCore::documentsForKeyword() doesn't work

    Solved 4 Jun 2020, 11:33
    0 Votes
    10 Posts
    593 Views
    @Christian-Ehrlicher good catch ! I have missed that line. I think it deserves a more prominent styling. I'll see to improve that.
  • QCameraInfo and OpenCV

    Unsolved 7 Jun 2020, 13:46
    0 Votes
    2 Posts
    206 Views
    Hi and welcome to devnet, You should rather enumerate the cameras with OpenCV as well so you will be consistent to access them.
  • 0 Votes
    7 Posts
    1k Views
    @Lior said in Signal inside readyread of QUdpsocket: why the UI main thread stoped to respond ? the msleep is in anthor thread. Because you do it wrong (and I would guess the msleep is not in the thread but in the gui thread) but without code...