Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.7k Posts
  • How to hide/unhide QWidget on hover.

    Solved qvideowidget qwidget hover hide unhide
    6
    0 Votes
    6 Posts
    2k Views
    JoeCFDJ
    @Saviz #include <QApplication> #include <QMouseEvent> #include <QVideoWidget> class HoverVideoWidget : public QVideoWidget { public: HoverVideoWidget(QWidget *parent = nullptr) : QVideoWidget(parent) { setMouseTracking(true); // Enable mouse tracking to get hover events } protected: void enterEvent(QEvent *event) override { // Called when the mouse enters the widget setStyleSheet("background-color: lightblue;"); // Set the background color to light blue } void leaveEvent(QEvent *event) override { // Called when the mouse leaves the widget setStyleSheet(""); // Reset the background color to default } }; int main(int argc, char *argv[]) { QApplication app(argc, argv); HoverVideoWidget player; player.show(); return app.exec(); }
  • Simple loop to extract json of any value type

    Solved json extract data json reply
    1
    0 Votes
    1 Posts
    269 Views
    No one has replied
  • QPlugin failing to load

    Solved
    11
    0 Votes
    11 Posts
    442 Views
    ocgltdO
    @SGaist Well I solved it...for anyone else interested. Although my poodle.so compiled fine, I had not linked in the Dog_Base and Animal_Base classes to the .so. Again - NO error on compilation. But, when I tried to load the poodle.so it could not find the ctor for the base class - because it was not linked in to the library's .so Very strange error...but solved!
  • QMediaPlayer crashes in response to drop event

    Unsolved
    4
    0 Votes
    4 Posts
    420 Views
    SGaistS
    @jboyce in that case, you should check the bug report system to see if there's something there and if not, please open a new ticket providing your example.
  • const QObject* overload for QMetaObject::invokeMethod

    Unsolved
    6
    0 Votes
    6 Posts
    542 Views
    Christian EhrlicherC
    @Loic-B said in const QObject* overload for QMetaObject::invokeMethod: By using mutexes ? If you access an object from different threads then you have to apply correct locking. Nothing Qt specific but Qt has a nice page about thread synchronization.
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    3 Views
    No one has replied
  • Incorrect Bounding Rect?

    Unsolved qfontmetrics qpainter
    3
    0 Votes
    3 Posts
    726 Views
    CJhaC
    @Pl45m4 In this function I am painting on axis->labelPix which is a QPixmap. The axis->labelPix is then put in its correct position using QPainter in the paintEvent() of PlotWidget.
  • .pro file which creates one .so per .cpp

    Unsolved
    2
    0 Votes
    2 Posts
    153 Views
    W
    By the time you are doing that level of QMake, you may just want to switch to using CMake. It's much better documented and more widely supported, so it's generally much easier to do unusual things with it.
  • Form Layout and Vertical Layout combo doesn't work as expected

    Solved
    7
    0 Votes
    7 Posts
    2k Views
    N
    @t-vanbesien said in Form Layout and Vertical Layout combo doesn't work as expected: I'm new to Qt and perplexed with layout and form layout behavior. First off what is displayed in the Design tab of Qt Creator is not the same as when I execute the program. One possible reason for this discrepancy is that the size and position of the widgets in your layout may change when you run the program based on factors such as the size of the window, the size of the screen, or the user's preferences. Another reason for the discrepancy could be that the Design tab may not accurately reflect the layout rules specified in your code. For example, suppose you've set minimum or maximum sizes for your widgets, or you've set some widgets to stretch or expand to fill available space. In that case, the Design tab may not show the exact positioning of widgets and their size as it may be affected by these rules. Layout and Form layout are used to organize and position widgets in your application's user interface. The main difference between the two is that a Layout can be applied to any QWidget-based object, while a Form layout is specific to the QWidget-based forms created by Qt Designer. Layouts automatically arrange widgets based on predefined rules, such as horizontal or vertical alignment or grid layout. With layouts, you don't have to manually set the position and size of each widget, which makes it easier to create and maintain your user interface. On the other hand, form layout is a specific type of layout used to organize widgets in a dialog box or other form. Form layout allows you to align and position widgets in rows and columns, making creating professional-looking forms with a consistent layout easy. the Design tab is a preview of what your user interface will look like, but it may not accurately represent the final result due to factors such as user preferences or layout rules. Layouts and Form layouts are valuable tools for organizing and positioning widgets in your application, with Form layouts being specific to creating forms.
  • Hiow to idetify which .pro is missing the library ?

    Unsolved
    4
    0 Votes
    4 Posts
    337 Views
    JoeCFDJ
    @AnneRanch in your project dir type command: grep -RHi lBT_Config_Library to find which pro files include it is it this dir? Leaving directory '/home/nov25-1/BLUETOOTH/BT_FEB22_FEB24_WORK/RECOVERY/BLUETOOTH/SOURCE/CCC_SOURCE/terminal_SERIAL_BLUETOOTH_VER_1/terminal_SERIAL_BLUETOOTH/terminal_BLUETOOTH
  • Qt icon theme switch

    Solved qss icon theme stylesheets
    4
    0 Votes
    4 Posts
    4k Views
    SGaistS
    Sorry for the very late reply, would it be possible to have a complete minimal compilable project to be able to test your issue ?
  • QWidgets stop responding to simulated mouse events

    Unsolved
    15
    0 Votes
    15 Posts
    2k Views
    P
    @jeremy_k After adding those events to the event filter, I don't see anything suspicious grabbing the mouse or keyboard. I don't get a single grab event anywhere. Plenty of focus changing, but none that look out of place.
  • QLineEdit crashing on recovering data

    Unsolved
    5
    0 Votes
    5 Posts
    310 Views
    JonBJ
    @Dummie1138 Why not run under a debugger and then you will know for yourself why it's crashing?
  • QTabWidget in QScroll area : concurrent scrolling

    Solved
    16
    0 Votes
    16 Posts
    2k Views
    S
    @JonB @mzimmers Yes, that was all in my thinking. @Pl45m4 Yes I understand. But as far as organizing widgets in a visually nice manner, nothing beats the designer in speed. Compiling every time I make the smallest change to test it just doesn't cut it ... and the "Use as placeholder for custom class" really can cover a lot, as I have discovered with this. Thanks all for contributions.
  • 0 Votes
    5 Posts
    544 Views
    C
    @Aviral-0 said in Hi I am trying to make NTP client which sync system time from NtpServer, and is Platform Independent for LINUX and WIN.: m_udpSocket->connectToHost("server 0.in.pool.ntp.org", 123); This not going to work. Since you do not check for a connected() signal (or equivalent) you will not have noticed this. The host name is invalid. Where do you send a request? My reading of the NTP UDP packet structure is that there is more data between the first byte and the various timestamp chunks. And is there any other way to do this? This particular wheel is well catered for on both Linux and Windows. Why reinvent it?
  • QTextEdit functionality

    Solved
    5
    0 Votes
    5 Posts
    249 Views
    SPlattenS
    @J-Hilk , @SGaist , OMG, found it, now I feel very stupid. Before the setData is being called the string is trimmed.
  • Datastream Qt c++

    Moved Unsolved
    4
    0 Votes
    4 Posts
    272 Views
    JonBJ
    @ChrisW67 Presumably only whether they are 0 or not :)
  • MHS TinyCAN plugin does not work on QT-6.4.2

    Unsolved
    1
    0 Votes
    1 Posts
    241 Views
    No one has replied
  • Check connection to dbus-daemon process does not work reliably

    Unsolved
    2
    0 Votes
    2 Posts
    225 Views
    Christian EhrlicherC
    Test it with a recent Qt version, when the error is still there write a bug report. But I doubt there are a lot of people using dbus on windows.
  • Trouble with resizing a QInputDialog

    Unsolved
    5
    0 Votes
    5 Posts
    663 Views
    Chris KawaC
    @Dummie1138 said): In any case, what would have been the issue with my resizing of the QInputDialog? QInputDialog uses the SetMinAndMaxSize on its layout. See the source. This constraint means that the widget's min and max size is set to the min and max sizes of its contents. Since the label and line edit have fixed heights your dialog also gets a fixed height of their sum (plus margins and spacing). With this layout resize mode your call to setFixedSize does not actually change the min and max values. You could change the mode like this passwordBox.layout()->setSizeConstraint(QLayout::SetDefaultConstraint); and that would let you set the fixed size, but it's kinda ugly, because it relies on the widget's internals and, like SGaist said, you'd be better off creating your own dialog, since you want to customize it even more. Btw. why do you want to remove the cancel button? It's an input dialog, so if users don't want to "talk" to you they should be able to back out of it. Seems like bad UX to remove that button.