Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
82.7k Topics 452.5k Posts
  • Use qss to custom QSlider.

    Unsolved
    6
    0 Votes
    6 Posts
    380 Views
    B

    @sven1991 Besides the good suggestions from @JonB and @hskoglund , I also feel that your animation looks more like a QProgressBar than a QSlider. Why would you need a slider with transparent handle and sub-page?
    But even with QProgressBar, the radius problem is still as the same as QSlider.

  • Qt5.15.2 app fails to build after building copy in Qt6.

    Unsolved
    7
    0 Votes
    7 Posts
    571 Views
    C

    Shadow build directories. Here is the CMake version for a simple program: identical source, two different binaries, no cross-contamination.

    chrisw@newton:/tmp/dummy$ ls src/ CMakeLists.txt main.cpp chrisw@newton:/tmp/dummy$ mkdir qt5_build qt6_build chrisw@newton:/tmp/dummy$ cd qt5_build/ chrisw@newton:/tmp/dummy/qt5_build$ CMAKE_PREFIX_PATH=/home/chrisw/Qt/5.15.2/gcc_64/ cmake ../src -- The CXX compiler identification is GNU 13.3.0 -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring done (0.1s) -- Generating done (0.0s) -- Build files have been written to: /tmp/dummy/qt5_build chrisw@newton:/tmp/dummy/qt5_build$ make [ 0%] Built target test_autogen_timestamp_deps [ 20%] Automatic MOC and UIC for target test [ 20%] Built target test_autogen [ 40%] Building CXX object CMakeFiles/test.dir/test_autogen/mocs_compilation.cpp.o [ 60%] Building CXX object CMakeFiles/test.dir/main.cpp.o [ 80%] Linking CXX executable test [100%] Built target test chrisw@newton:/tmp/dummy/qt5_build$ ldd test | grep Qt libQt5Core.so.5 => /home/chrisw/Qt/5.15.2/gcc_64/lib/libQt5Core.so.5 (0x000073a612600000) libicui18n.so.56 => /home/chrisw/Qt/5.15.2/gcc_64/lib/libicui18n.so.56 (0x000073a611600000) libicuuc.so.56 => /home/chrisw/Qt/5.15.2/gcc_64/lib/libicuuc.so.56 (0x000073a611000000) libicudata.so.56 => /home/chrisw/Qt/5.15.2/gcc_64/lib/libicudata.so.56 (0x000073a60f400000) chrisw@newton:/tmp/dummy/qt5_build$ cd ../qt6_build/ chrisw@newton:/tmp/dummy/qt6_build$ CMAKE_PREFIX_PATH=/home/chrisw/Qt/6.8.1/gcc_64/ cmake ../src -- The CXX compiler identification is GNU 13.3.0 -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success -- Found Threads: TRUE -- Performing Test HAVE_STDATOMIC -- Performing Test HAVE_STDATOMIC - Success -- Found WrapAtomic: TRUE -- Configuring done (0.3s) -- Generating done (0.0s) -- Build files have been written to: /tmp/dummy/qt6_build chrisw@newton:/tmp/dummy/qt6_build$ make [ 0%] Built target test_autogen_timestamp_deps [ 20%] Automatic MOC and UIC for target test [ 20%] Built target test_autogen [ 40%] Building CXX object CMakeFiles/test.dir/test_autogen/mocs_compilation.cpp.o [ 60%] Building CXX object CMakeFiles/test.dir/main.cpp.o [ 80%] Linking CXX executable test [100%] Built target test chrisw@newton:/tmp/dummy/qt6_build$ ldd test | grep Qt libQt6Core.so.6 => /home/chrisw/Qt/6.8.1/gcc_64/lib/libQt6Core.so.6 (0x00007c84dd200000) libicui18n.so.73 => /home/chrisw/Qt/6.8.1/gcc_64/lib/libicui18n.so.73 (0x00007c84dc600000) libicuuc.so.73 => /home/chrisw/Qt/6.8.1/gcc_64/lib/libicuuc.so.73 (0x00007c84dc200000) libicudata.so.73 => /home/chrisw/Qt/6.8.1/gcc_64/lib/libicudata.so.73 (0x00007c84da200000)
  • 0 Votes
    3 Posts
    249 Views
    Pl45m4P

    @markleo said in Apart from the modules provided by the official website, are there any other third - party Qt modules? If so, is there a central repository similar to npmjs.org?:

    third - party Qt modules

    What are third-party Qt modules?!
    Modules not made by Qt devs and published in the official Qt releases are not "Qt"...

    Since Qt is still just a C++ GUI framework and still not its own programming language like JavaScript, there are thousands of projects made by users/contributors on GitHub and similar sites, which work with or add something to Qt... custom widgets, functions or just code snippets...

    Edit:
    What @ChrisW67 is referring to is what I meant..."extensions" like QxORM can be integrated because of Qt's C++ API... but so does every C++ library work with your C++ project

  • 0 Votes
    2 Posts
    227 Views
    Q

    This issue has been resolved in version 6.8! Thank you for your attention!

  • 0 Votes
    9 Posts
    656 Views
    Christian EhrlicherC

    @csab6597 said in QColorDialog broken becaus of new Windows 11 style spin buttons:

    Well ok, I definitely expected the final fix to be resizing the spin buttons such that they stack vertically again, as it was before 6.7.

    No, the windows11 style places them the way it is.

    So we will now have different spin buttons per operating system,

    I don't see a problem here - windows 11 looks different than macos, kde or gnome. If you want the same style for every os then hard-code it to fusion style.

  • How to detect spawning and destruction of windows?

    Unsolved
    2
    0 Votes
    2 Posts
    155 Views
    S

    I think you can do this with a so called shell hook library.

    https://learn.microsoft.com/en-us/windows/win32/winmsg/about-hooks

    See the part about monitoring messages. When a new window is created a WM_CREATE message is posted to the window's event queue.

  • Render a widget on top of others at runtime

    Unsolved
    4
    0 Votes
    4 Posts
    226 Views
    GrecKoG

    @Pl45m4 said in Render a widget on top of others at runtime:

    What do you mean by "on top"? As separate window? What's the point of the stacked widget then?
    Why don't you just switch the stacked widget page to show your game widget?!

    From what I understand this is meant as a non-modal popup/overlay. Everything doesn't have to be in the same plane in a UI, overlap is sometime wanted.

    @franco-amato How is m_gameWindow created?
    If you want to show it on top of m_ui->mainContainer, just create it with mainContainer as the parent. Don't add it to a layout or the QStackedWidget. The mapTo shouldn't be necessary since its position would be relative to its parent. raise shouldn't be needed if its added the the container last.

  • QPixMap management

    Unsolved
    6
    0 Votes
    6 Posts
    221 Views
    JonBJ

    @JacobNovitsky
    Images are shown on QLabels. Use those as the widgets you add to the FlowLayout.

  • 0 Votes
    4 Posts
    232 Views
    Y

    @Cobra91151 thank you,I have reinstalled some dependencies according to the steps on the official Qt website, and this issue has been resolved. Thank you very much. The main missing component was the LLVM that you mentioned.

  • Open source and they obligations for personal use.

    Unsolved
    2
    0 Votes
    2 Posts
    173 Views
    Pl45m4P

    @mackowy said in Open source and they obligations for personal use.:

    If I want to use it for my own personal, non-commercial use, without publishing anything, can i simply ignore staff like this and enjoy for free?

    As long as you dont violate (L)GPLv3, yes...

    does it force me to publish?

    No, feel free to contribute or just enjoy using Qt.
    It's about the whole open source community not about every single individual :)

    Btw through posting this here you are already contributing in some way...

  • 0 Votes
    3 Posts
    192 Views
    G

    @Christian-Ehrlicher Yes, it is window style show, when linux the arrow is in Header Text right, how to set to arrow to right under window system? Thanks.

  • 0 Votes
    13 Posts
    579 Views
    Pl45m4P

    @mpnix said in How to add a 3rd party C++ library to a Qt project?:

    So, what does "do it properly" mean in reality? Sticking with CMake seems a first wise step (I only looked at the "Make" stuff to see if it gave me any different outcome - it didn't).

    After taking a closer look, it seem to require a Cygwin environment under Windows, which is also stated here:

    @Pl45m4 said in How to add a 3rd party C++ library to a Qt project?:

    Requirements

    The exiftool application must exist on the system. This interface should be platform independent, and has been tested on Mac OS X, Linux, and Windows (Cygwin).

    So it's only "pseudo" platform-indepentent.
    Can't tell you much about Cygwin... for Unix/Linux optimized stuff I use Linux directly and not Windows.

    You could try another, more Windows friendly, Exif library. For example this one:

    https://github.com/exiv2/exiv2

    As far as I can see, it also supports CMake builds "out-of-the-box"... so no MakeFile converting etc. etc.

  • 0 Votes
    2 Posts
    147 Views
    Pl45m4P

    @Mizmas

    AFAIK no, because objects are always in their parent's coordinate system.

  • Sniffing with pcap in a GUI application

    Unsolved
    3
    0 Votes
    3 Posts
    114 Views
    JonBJ

    If pcap calls block/are synchronous then it would presumably have to go into its own thread.
    If calls are non-blocking/asynchronous then you can use those from main thread. If it's suitable maybe you can make calls on a timer. E.g. call your code intermittently rather than in a blocking loop.

  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    18 Views
    No one has replied
  • 0 Votes
    2 Posts
    118 Views
    C

    Regarding your notes: it may be independent of all those things but it may be dependent on the compiler toolchain used, the Qt version in use, and the Windows version for both recording and playback.

    The Windows component that generated the audio stream provided something odd that Windows Media Player cannot understand. ffmpeg produces valid AAC Low Complexity the Windows Media Player does understand. It's unclear what the original stream is. If the original stream was AAC Main Profile then ffprobe would have reported "Audio: aac (Main) (mp4a / 0x6134706D)...". High Efficiency AAC would be reported as "Audio: aac (HE-AAC) (mp4a / 0x6134706D)" (and less likely to be playable).

    Does the audio play correctly if extracted from the container?

    ffmpeg.exe -i original_video.mp4 -c: copy -vn original_video_audio.m4a
  • QToolTip and QLineEdit

    Solved
    4
    0 Votes
    4 Posts
    308 Views
    JonBJ

    @gabello306
    Don't forget you should polish the style after this dynamic setProperty() change. QStyle::unpolish()/polish(), QWidget::ensurePolished(). Else it may not update immediately.

  • 0 Votes
    7 Posts
    237 Views
    InTheBeningingI

    Using a custom QStyledItemDelegate like this

    class CustomListWidgetItemDelegate : public QStyledItemDelegate { public: void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override { painter->save(); if (option.state & QStyle::State_Selected) painter->fillRect(option.rect, option.palette.highlight()); else if (option.state & QStyle::State_MouseOver) painter->fillRect(option.rect, option.palette.highlight()); //left aligned if(index.data(Qt::DisplayRole).isValid()) { QString text = index.data(Qt::DisplayRole).toString(); painter->drawText(QPoint(option.rect.left() + 5, option.rect.bottom()-5), text); } //right aligned if(index.data(Qt::UserRole).isValid()) { QString text = index.data(Qt::UserRole).toString(); int textwidth = painter->fontMetrics().boundingRect(text).width(); painter->drawText(QPoint(option.rect.right() - textwidth - 5, option.rect.bottom()-5), text);; } //fixed if(index.data(Qt::UserRole + 1).isValid()) { QString text = index.data(Qt::UserRole + 1).toString(); painter->drawText(QPoint(200, option.rect.bottom()-5), text);; } painter->restore(); } };

    Now that theres more than one text, the other texts are stored in UserRoles

    //install delegate on the ListWidget ui->listWidget->setItemDelegate(new CustomListWidgetItemDelegate); QListWidgetItem * item = nullptr; for(int i = 0; i < 5; i++) { item = new QListWidgetItem("ListItem"); item->setData(Qt::UserRole, "Yep"); item->setData(Qt::UserRole + 1, "Maybe"); ui->listWidget->addItem(item); }
  • How to set the text wrapped in the tablewidgetitem?

    Unsolved
    2
    0 Votes
    2 Posts
    87 Views
    SGaistS

    Hi,

    It's on the view. Check setWordWrap.

  • How to catch Ctrl+C on a widget?

    12
    0 Votes
    12 Posts
    22k Views
    I

    Maybe it's because the toolbar of the software has shortcuts like ‘ctrl+c,ctrl+e’ or something like that, where you need to press ctrl+c first and then press other keys to make it work.