Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.7k Posts
  • QWidgte::setSizeIncrement() not have effect

    Solved
    6
    0 Votes
    6 Posts
    718 Views
    G
    @giusdbg In wayland there are various things that are complicated or impossible to fix, I decided for this trick int main(int argc, char *argv[]) { if (!qEnvironmentVariableIsSet ( "QT_QPA_PLATFORM" )) qputenv( "QT_QPA_PLATFORM", "xcb" ); If anyone cares about the code that was trying to handle the jerky resize manually this is it (it doesn't work badly, but it doesn't have stable behavior and throws an infinite resize->timer->resize event loop) qtResize.setSingleShot(true); connect(&qtResize, SIGNAL(timeout()), this, SLOT(resizeDone())); ........................ bool LMSensorsWidget::event(QEvent *event) { // qDebug() << "\033[91m" << "qDebug(): LMSensorsWidget::event event->type()" << event->type() <<"\033[0m"; switch (event->type()) { case QEvent::NonClientAreaMouseButtonRelease: // resize (size()); break; case QEvent::Resize: /* if (event->spontaneous()) return false; */ case QEvent::UpdateRequest: qtResize.stop(); qtResize.start(500); break; default: break; } return QWidget::event (event); } void LMSensorsWidget::resizeDone() { QSize qsResize, qsSnap, qsObj; QRect qrGeom; qsResize = size(); qsSnap.setWidth(int((qsResize.width() / 64.0) + 0.5) * 64.0); qsSnap.setHeight(int((qsResize.height() / 64.0) + 0.5) * 64.0); // if (qsSnap != qsResize) { resize(qsResize.width(), qsResize.height() -1); resize(qsSnap); } }
  • QTreeWidget gird lines

    Unsolved
    4
    0 Votes
    4 Posts
    700 Views
    G
    Thanks for all your help. Gary
  • 0 Votes
    2 Posts
    209 Views
    SGaistS
    Hi, Please use coding tags when posting code. Otherwise it's unreadable. Next, reduce your code to the bare minimum required to analyse your issue. Remove everything unrelated to your issue. Not many people will be interested in going through that much code with just an error message as entry point. One thing that is an issue I can see is that you are declaring your invokable function in the slot section of your class. Although related, they are two different things.
  • Why does it show me an error when trying to compile in static

    Unsolved
    4
    0 Votes
    4 Posts
    418 Views
    Axel SpoerlA
    @lincoln The issue occurs during configure and compilation doesn't even start. Could you please post the entire CMakeLists.txt as well as the configure output?
  • Can't upload app to QT Design Viewer: "QtQuick not installed"

    Unsolved
    3
    0 Votes
    3 Posts
    188 Views
    P
    @jsulm I'm sorry, I don't know. How do I check/install it if it isn't?
  • 0 Votes
    9 Posts
    1k Views
    J
    Announcing that this problem is solved. I am really appreciate and grateful to your suggestions and advice, after all the segment fault is no more occur. šŸ™šŸ». It troubles me for around a week.
  • Incorrect file types and sizes

    Solved
    3
    0 Votes
    3 Posts
    202 Views
    M
    @Christian-Ehrlicher Thank you. That solved it.
  • QGraphicsItem replace boundingRect with more precise shape

    Unsolved
    5
    0 Votes
    5 Posts
    651 Views
    A
    @JonB said in QGraphicsItem replace boundingRect with more precise shape: I don't know what "hexcrawl" games are. But if you mean you have some kind of map, and then you draw hexagons on it, and perhaps then you add "objects" or "counters" onto it which you move around, then representing the map as individual hexagon QGraphcsItems is probably not the way to go. For such a situation you are better using drawBackground() to show a map with the hexagons drawn on it, and QGraphicsItems only for the objects you place onto the map. Actually, I am not going to be moving many objects around (maybe only one or two). The selection of hexes will be to access additional information to that shown by the hex's visual content (a small string + a couple of simple shapes). I thought about using a simple background, as you suggest, but felt like I would then have to rely on using the selection on smaller items, which did not seem ideal.
  • Proper event-handling in void event(QEvent *)

    Unsolved
    12
    0 Votes
    12 Posts
    2k Views
    U
    @Axel-Spoerl said in Proper event-handling in void event(QEvent *): That depends on the use case. If another QObjectshould do something reasonable with these events, it's better to ignore them. If the custom button is supposed to absorb the noise and make sure, nothing gets distracted - it's better to accept and return true(even if nothing is actually done). Okay, will do that. So far my touch-buttons are working mostly fine. However there is still one annyoing thing: If I place multiple of those buttons together in a groupbox, frame, etc., I can trigger multiple tap gestures at the same sime. Pressing Button A Button A "Gesture started" Pressing Button B Button B "Gesture started" Withdrawing one finger from Button A/B Button A/B "Gesture finished" Withdrawing second finger from other Button B/A Button B/A "Gesture finished" This behaviour is fine for me: It is actually multi-touch support and does not hurt me. However, if I accidentally touch the underlying QGroupBox, the event gets canceled: Pressing Button A Button A "Gesture started" Touching the GroupBox with a second finger Button A "Gesture canceled" Withdrawing one finger of Button A or the GroupBox Nothing happens. Withdrawing the second finger Nothing happens. Is there a way to setup these events so that the behaviour is uniform: Touching something other than the currently pressed Button always causes "Gesture canceled" in the Button (basically only single-touch support) Touching something other than the currently pressed Button never causes "gesture canceled" (basically multi-touch support). Thanks for your support!
  • Couldn't catch signal from Cpp in QML

    Solved
    5
    0 Votes
    5 Posts
    344 Views
    Christian EhrlicherC
    @johndummy said in Couldn't catch signal from Cpp in QML: One has to capitalize the first alphabet even if its declaration doesn't have uppercase first latter Not that this is documented somewhere.
  • How automation on qt?

    Unsolved mouse automation screenshot
    3
    0 Votes
    3 Posts
    597 Views
    jsulmJ
    @timob256 I'm not sure whether you want to animate the mouse cursor movement, if that is what you want then take a look at https://doc.qt.io/qt-5/animation-overview.html
  • Crash in closeEvent()

    Solved
    3
    0 Votes
    3 Posts
    393 Views
    deisikD
    It turned it out to be a system-wide issue after an uptime of couple months or so. Any program (for example, Firefox) would be forcefully closed after a few seconds if it showed a warning dialog box on exit
  • Ubuntu 22.04 with Qt 6 Crash

    Solved
    7
    0 Votes
    7 Posts
    1k Views
    D
    An update for anyone who comes across this: It was an issue with the amdgpu drivers and default package manager Vulkan libraries. To get everything working with wayland, I first downloaded amdgpu_install deb package from AMD drivers page (just filled in GPU info and it brought me to the download page) - they call it "Radeon Software for Linux". Installed the deb once downloaded (used apt install on it). Once installed, amdgpu_install is available to use in the terminal. Read the instructions for which options to use when running amdgpu_install. I went with: amdgpu_install -y --vulkan=amdvlk,pro --opencl=rocr,legacy --accept-eula Once the driver is installed (with reboot), the newest vulkan SDK needs to be installed. This is easily missed but it's mentioned in the driver page "Release Notes". I just went to https://vulkan.lunarg.com/sdk/home and followed the instructions to install the latest SDK using the package manager - the apt instructions for me were: wget -qO- https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo tee /etc/apt/trusted.gpg.d/lunarg.asc sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-1.3.250-jammy.list https://packages.lunarg.com/vulkan/1.3.250/lunarg-vulkan-1.3.250-jammy.list sudo apt update sudo apt install vulkan-sdk I could see the above command installing a bunch of qt wayland libraries so I was hopeful. Sure enough, once complete, the crash was gone.
  • How to capture double click on title bar

    Unsolved
    2
    0 Votes
    2 Posts
    492 Views
    M
    @deisik Hi, Mainly, it's OS dependent (on Linux linked to the Window Manager) Personally, on mac, I have choosen the zoom option instead of minimize and I would not really appreciate some apps to pass over my choice :)
  • how can i set QDockWidget without close button?

    Unsolved
    9
    0 Votes
    9 Posts
    5k Views
    O
    scenesDock->setFeatures(QDockWidget::NoDockWidgetFeatures); did the job for me if you still have the problem i believe this will solve the issue
  • Detect changing devicePixelRatio

    retina devicepixelrati
    7
    0 Votes
    7 Posts
    10k Views
    I
    @fxxxx you should set attribute for your main window: setAttribute(Qt::WA_NativeWindow); but it causes optimization problems, because it is legacy feature. anyway, it will solve your problem, and windowHandle() should return valid pointer, and will emit signal screenChanged().
  • call w.show() in another Thread

    Unsolved
    3
    0 Votes
    3 Posts
    238 Views
    S
    All GUI calls have to go through the main thread. You can, however, put the call to w.show() from another thread into the main thread. Using signals and slots was already mentioned. I personally don't like to write a whole bunch of signals and slots for this. What I do instead is to use QMetaObject::invokeMethod(qApp, [&w](){ w.show(); });. qApp will give you the instance of QApplication and invoke the lambda in the context (i.e. the thread) of qApp). You need to make sure that any work related to your window still executes inside another thread. I have put all my knowledge and different use cases particularly related to this question into a library: https://github.com/SimonSchroeder/QtThreadHelper
  • This topic is deleted!

    1
    0 Votes
    1 Posts
    7 Views
    No one has replied
  • QSettings - make INI format case-sensitive on windows

    Unsolved
    5
    0 Votes
    5 Posts
    918 Views
    T
    @SimonSchroeder I will try this ... just have to find the writeFunc code in the Qt codebase ...
  • Documentation required for the sale of software under the LGPL license

    Unsolved
    17
    0 Votes
    17 Posts
    970 Views
    JonBJ
    @SimonSchroeder For "TQtC" as @jsulm wrote :) GPL in particular (under which several Qt components are released) requires users to release the full source of their code. Paying TQtC for a commercial license frees the author of that requirement, which I guess can be very useful for a commercial developer. For the (majority) LGPL parts I imagine it also frees them from the responsibility of maintaining Qt source access for customers (not sure about this one, just a presumption).