Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.3k Topics 455.9k Posts
  • Accessibility for Custom Painted Items

    Unsolved accessibility screen reader focus issue
    1
    0 Votes
    1 Posts
    43 Views
    No one has replied
  • Issue in qvulkanwindow.cpp ?

    Unsolved
    6
    0 Votes
    6 Posts
    196 Views
    SGaistS
    You should check the bug report system to see if it's something known and if not, please open a ticket providing minimal compilable example that triggers the crash.
  • Specifying Color for progress bar in QProgressBar

    Unsolved
    5
    0 Votes
    5 Posts
    5k Views
    R
    I know I'm late the the game on this particular request, but I recently had the same need and found what I think is a better and easier solution. In particular, I liked the look of the base style and only wanted the color of the chunk, and for light colored chunks, have a dark text over it. The general principle is to make a copy of the QPalette for the QProgressBar in question. Then change QPalette::Highlight role color and the QPalette::HighlightText role based on the parameter being displayed in the copy and then assign the QPalette to the QProgressBar. Do this in the valueChanged(int) slot. In my example, I was assessing a motor speed. void MainWindow::on_TachometerBar_valueChanged(int value) { static QPalette p(ui->TachometerBar->palette()); //Static used here to only initialize once if (value < 600) { p.setColor(QPalette::Highlight, Qt::yellow); p.setColor(QPalette::HighlightedText, Qt::black); } else if (value < 1800) { p.setColor(QPalette::Highlight, Qt::darkGreen); p.setColor(QPalette::HighlightedText, Qt::white); } else if (value < 2000) { p.setColor(QPalette::Highlight, Qt::yellow); p.setColor(QPalette::HighlightedText, Qt::black); } else { p.setColor(QPalette::Highlight, Qt::red); p.setColor(QPalette::HighlightedText, Qt::white); } ui->TachometerBar->setPalette(p); } [image: 2a253b91-3d26-4d73-854c-af80d74579ee.png] [image: fffdcb68-1aa0-4487-8470-bcc6f6d706ba.png] [image: 0dc7e0c5-5377-4c7c-bc57-a883b7399bb8.png] [image: f31e6199-cbbe-4eec-8e87-e55a44b3e19e.png]
  • Dependent (that clearly exists) does not exist error when building Qt Creator project

    Unsolved
    24
    1 Votes
    24 Posts
    13k Views
    H
    @saurabhjadhav1911 Amazing! It works. Thank you very much!! But why?
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    4 Views
    No one has replied
  • QWidget::mousePressEvent() fail to capture the left click event

    Unsolved
    4
    0 Votes
    4 Posts
    49 Views
    W
    @Pl45m4 Oh okay. I will have a look at the other part of the code. Do you know why the left click can be detected within the eventfilter? Does it mean that the event captured by eventfilter would be the higher priority?
  • Trying to use AddressSanitizer with Qt on Windows

    Unsolved
    13
    0 Votes
    13 Posts
    210 Views
    J
    There are lots of differences in the command line options between VS and Qt. Basic project in both cases is the default GUI application. Qt: -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -permissive- -Zc:__cplusplus -Zc:externConstexpr -fsanitize=address -Zi -MDd -std:c++17 -utf-8 -W3 -w34100 -w34189 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc /Fddebug\asan_test.vc.pdb -DUNICODE -D_UNICODE -DWIN32 -D_ENABLE_EXTENDED_ALIGNED_STORAGE -DWIN64 -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I..\..\dev\asan_test -I. -I..\..\Qt\6.9.0\msvc2022_64\include -I..\..\Qt\6.9.0\msvc2022_64\include\QtWidgets -I..\..\Qt\6.9.0\msvc2022_64\include\QtGui -I..\..\Qt\6.9.0\msvc2022_64\include\QtCore -Idebug -I. -I/include -I..\..\Qt\6.9.0\msvc2022_64\mkspecs\win32-msvc -Fodebug\ @C:\Users\jazzco\AppData\Local\Temp\main.obj.18184.15.jom VS: /JMC /permissive- /ifcOutput "WindowsASanTest\x64\Debug\" /GS /W3 /Zc:wchar_t /Zi /Gm- /Od /sdl /Fd"WindowsASanTest\x64\Debug\vc143.pdb" /Zc:inline /fp:precise /D "_DEBUG" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /errorReport:prompt /fsanitize=address /WX- /Zc:forScope /RTC1 /Gd /MDd /FC /Fa"WindowsASanTest\x64\Debug\" /EHsc /nologo /Fo"WindowsASanTest\x64\Debug\" /Fp"WindowsASanTest\x64\Debug\WindowsASanTest.pch" /diagnostics:column The options differ in VS are: /JMC = Just My Code /WX- = Treat Warnings as Errors OFF /sdl = Enables recommended Security Development Lifecycle /Od = disable optimization /D <> = define constant/macro /Gm- = disable miminal build (deprecated) /RTC1 = Enable fast runtime checks /GS = Checks buffer security /fp:precise = "precise" floating-point model; results are predictable. /Zc:forScope = Enforce Standard C++ for scoping rules (on by default). /Fo<> = Creates an object file. /external:W3 = Set warning level for external headers. /Gd = Uses the __cdecl calling convention. (x86 only) /TP = Specifies all source files are C++. /FC = Displays the full path of source code files passed to cl.exe in diagnostic text. /errorReport = deprecated I added several options to Qt, like -JMC -GS -sdl -RTC1 to get it up but the process still crashes in debug mode at the same spot even with a clean default project without the faulty source code. In release mode it works but doesn't recognize the malicious code. EDIT: fixed wrong VS command line
  • 0 Votes
    13 Posts
    220 Views
    Axel SpoerlA
    Looks like the bug doesn't reproduce anymore.
  • 1 Votes
    7 Posts
    174 Views
    Christian EhrlicherC
    @Jammin44fm said in QT_ENABLE_HIGHDPI_SCALING misbehaving when windows scaling is set to 200%: QT_ENABLE_HIGHDPI_SCALING "This variable is intended for testing purposes only, and we do not recommend setting it on a permanent basis." So don't use it...
  • Qt and Apple 'Glass' UI in macOS 26

    Unsolved
    10
    1 Votes
    10 Posts
    566 Views
    AndyBriceA
    @Tor-Arne said in Qt and Apple 'Glass' UI in macOS 26: That depends on how easy it is for us to provide that look via the built in styles, which we are still researching. I hope you will be able to come up with something. Where will decisions on this be announced?
  • Linker error for vcpkg built package

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

    Unsolved
    1
    0 Votes
    1 Posts
    3 Views
    No one has replied
  • No pen cursor n Qt library

    Unsolved
    13
    0 Votes
    13 Posts
    551 Views
    AtesCompA
    For Linux, the standard set of cursors for cursor themes are documented in /usr/include/X11/cursorfont.h. These are the 'well known' cursors under Linux OSes and have been for decades (notice the "Copyright 1987, 1998 The Open Group"). For documentation, see: For KDE (in particular Creating the symlinks) For General X11 Note the XC_pencil entry. Yes, there are a lot of silly ones (XC_bogosity anyone). I'm almost sure the Qt devs know this. They had to have done some kind of background research on this to get the Qt::CursorShape enums to map to the system's cursor theme. There...homework done! Extra Credit: All of the entries are related to so-called cursor state. The cursor images map to one or more states . A cursor theme does not require all cursor state be mapped by cursor images, so some cursors may be missing from a theme. However, a "good" theme should have an Inherits= key-value in the [Icon Theme] section of its the index.theme file so that it has a chance to complete the entire theme with some kind of cursor image for each state. What does Qt do when a system cursor is not present in the current theme? In any case, the best practice is to test for these cursors by the given Qt::CursorShape enums and, if not found, provide your own by using QCursor(const QPixmap...) or QCursor(const QBitmap...). Admittedly, the Qt::CursorShape enums should likely expand to cover all standard cursor icons provided by the OS. The QCursor(Qt::CursorShape shape) and void QCursor::setShape(Qt::CursorShape shape) method should likely throw some exception when a cursor is not actually found in the system's current theme. Or, to make things a bit nicer, change setShape() to return a boolean value.
  • Qt Qml edit in Jetson Nx orin Ubuntu 20.04

    Unsolved
    2
    0 Votes
    2 Posts
    32 Views
    SGaistS
    Hi and welcome to devnet, You can use your main machine to edit your project and copy it over to your Jeston. Qt Design Studio is available Open Source.
  • QT HTML to pdf width error

    Unsolved
    2
    0 Votes
    2 Posts
    45 Views
    Pl45m4P
    @JISU Hi, try QPdfWriter instead and I don't think the style width = 100% is supported, so you get your table, but not stretched over the whole page.
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    2 Views
    No one has replied
  • repaint() doesn't, well, repaint when the app doesn't have focus

    Solved
    2
    0 Votes
    2 Posts
    56 Views
    S
    Never mind - seems to be related to the widget being a subclass of QOpenGLWidget. If I change it to a subclass of QWidget, I get my updates just fine. I don't actually need QOpenGLWidget (I was just thinking it might be useful in future) so I'm good.
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    2 Views
    No one has replied
  • 0 Votes
    2 Posts
    74 Views
    Z
    @PuskasAlex said in Cannot show modal dialog or block in QFileSystemModel::dropMimeData() or QTreeView::dropEvent() in Qt 6 during drag and drop: QTreeView::dropEvent(event); Hi, Delete QTreeView::dropEvent(event) and everything will work fine: if (QMessageBox::question(this, "title", "body") == QMessageBox::Yes) event->accept();; else event->ignore();
  • Creating a Double Scrollbar

    Solved
    8
    0 Votes
    8 Posts
    248 Views
    hskoglundH
    If you indeed can have both arrows on the same of the scrollbar, then another approach could be: create a 2nd identical scrollbar which you stack underneath the 1st one (by setting the z-order) and place it so that only the 2 arrows are visible. Then connect the left-right signals from that scrollbar to the slots for 1 st :-)