Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.5k Posts
  • detect debug/release in .pro file: message is only correct 2 out of the 3 messages?

    Unsolved
    3
    0 Votes
    3 Posts
    264 Views
    C
    @kkoehne Thank you. It tells me qmake runs 3 times to generate the configuration for different situations (debug,release and debug and release), and therefore it gives me three times the messages. I didn't expect qmake to run 3 times.
  • Can't set up CMake. Getting errors.

    Solved cmake error c++ qt designer vscode
    12
    0 Votes
    12 Posts
    6k Views
    J
    @jsulm I used to believe that the only way to create a C++ GUI was through Qt Design Studio, as I had never created anything in C++ other than console programs. I've created a GUI in Python in the past with it. However, I stumbled upon examples in Qt Creator that use .ui files. I'm familiar with this approach, having worked with UI and widgets before. I believe I'll continue using widgets since they don't show any errors when the program is executed. I will close this conversation as I no longer require assistance with qml. If I encounter any further issues, I'll post on a forum if I'm unable to resolve them myself. Thank you to everyone who tried to help me.
  • Restored cursor stays as ForbiddenCursor one after drag and drop

    Unsolved
    2
    0 Votes
    2 Posts
    224 Views
    M
    @MrAWD One more test that still didn't work. Once I get a signal that thread has finished, in the slot code I have added join() call to make sure thread has really finished, so the cursor is not prematurely changed, but that didn't help and I still ended up with ForbidenCursor. class MyClass(): threadDone = Signal() def __init__(self): self.threadDone.connect(self.onThreadDone) def initialize(self): QApplication.setOverrideCursor(Qt.WaitCursor) self.thread = threading.Thread(target=self.startThread) self.thread.setDaemon(True) self.thread.start() def startThread(self): sleep(3) # this is instead of the initialization wait self.threadDone.emit() def onThreadDone(self): self.thread.join() QApplication.restoreOverrideCursor() The only way I was able to get correct cursor was if I have a join() call right after the thread start() (see below). Once thread is joined this way, cursor is restored back to the Arrow one. The problem with this implementation is that it looks identical to the one without the thread to start with. User has to wait couple of seconds for the initialization to complete and it is pretty annoying. def initialize(self): QApplication.setOverrideCursor(Qt.WaitCursor) self.thread = threading.Thread(target=self.startThread) self.thread.setDaemon(True) self.thread.start() self.thread.join() QApplication.restoreOverrideCursor()
  • MacOS Valgrind alternative. Which one?

    Unsolved
    3
    0 Votes
    3 Posts
    2k Views
    D
    @bogong Why don't you use clang's address/leak sanitizer on macOS? with CMake it would be something like this: set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O1 -fsanitize=address -g -fno-omit-frame-pointer")
  • How to set qss property back to its default value?

    6
    1 Votes
    6 Posts
    8k Views
    H
    @old9 The -1 worked perfectly for me for qtoolbar width. I didn't see this documented anywhere and needed it badly. Thank you.
  • In console how to prevent from going to the next line and read text stream

    Solved
    3
    0 Votes
    3 Posts
    248 Views
    A
    @ChrisW67 I think I got it, actually earlier it was opening the Application output console, I just clicked the option of run in terminal in the build & run option and now it's working fine.
  • Qt C++ lnk2019 errors with opengl widget

    Unsolved
    8
    0 Votes
    8 Posts
    2k Views
    jsulmJ
    @mateuszusd said in Qt C++ lnk2019 errors with opengl widget: What should do to solve this problem in visual studio2022 What was already suggested
  • 0 Votes
    33 Posts
    11k Views
    T
    Thanks to all for support and your valuable suggestions. I am successfully made executable file using (Qt creator 5.9.5) compiler version (Mingw 5.3.0) using windeployqt.
  • Color management on Qt5 and Qt6 (macOS)

    Unsolved
    2
    0 Votes
    2 Posts
    267 Views
    jsulmJ
    @metamerism Please post the quests
  • 0 Votes
    3 Posts
    385 Views
    ademmlerA
    @johngod Thx John I checkt his out but it did not worked. However I found simple a solution: The rendering of Qt is in pixels without any scaling. This means that the scaling factor is (physical screen resolution / divided by image desinty)
  • QRegex help

    Unsolved
    2
    0 Votes
    2 Posts
    185 Views
    C
    @Rua3n By default: The RE dot . does not match newlines A string containing multiple newlines is a single string to the RE Your RE tester is feeding the lines in your test string one at a time. You are feeding the RE all the input as a single string. The RE cannot match because the first newline in the string cannot be consumed by the .* Try: QRegularExpression regex(s, QRegularExpression::MultilineOption); This will not remove lines, but it will remove the text matched leaving a vestigial \n
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    11 Views
    No one has replied
  • Qt from crontab errors

    Unsolved
    5
    0 Votes
    5 Posts
    628 Views
    C
    I am going to guess that you are trying to create some sort of kiosk machine that automatically launches a UI at system start. If that is what you are after then you should consider: Enable Autologin Use a custom .xsession file to launch your application when X starts. Other ways to address this involve using /etc/inittab (not crontab) to launch a script that starts X and then your kiosk application. This approach can ensure the UI is restarted if it crashes. How this interacts with a systemd-ified environment I cannot say.
  • Make Qt terminal app executable and add it to favorites tab @ Ubuntu

    Unsolved
    5
    0 Votes
    5 Posts
    544 Views
    C
    @JacobNovitsky Right-click where exactly? The right-click menu is generally context sensitive and also populated with actions not applications.
  • How to install Qt 6.4.3 or newer (fresh update) without gui

    Unsolved
    2
    0 Votes
    2 Posts
    1k Views
    SGaistS
    Hi, Here you have the documentation on how to sue the online installer from the command line. Otherwise, there is also the aqinstall project.
  • How to rotate QGraphicsItem right after mouse?

    Solved
    5
    0 Votes
    5 Posts
    698 Views
    johngodJ
    @Valderman I did something like that in a project of mine, but with a difference that the rectangle does not rotate in his center but rotates relative to a center defined in a first click position called commandInitialPos, then you do a second click to start rotating, then you move the mouse to rotate. I am posting the relevant code I used may it can be helpfull for you to adapt the relevant pseudo code and link to the project: https://bitbucket.org/joaodeusmorgado/techdrawstudio/src/142960ab5c809ddcbd20fb40f294e01d85c850d5/qml/qmlEntities/EntityTemplate.qml#lines-117 //first click - define the center of rotation onCommandCprStart: function(pos) { commandInitialPos = pos //assume that pos is the mouse click position } https://bitbucket.org/joaodeusmorgado/techdrawstudio/src/142960ab5c809ddcbd20fb40f294e01d85c850d5/qml/qmlEntities/RectangleThick.qml#lines-39 //second click - start rotation position onCommandCprUpdate: function(pos, ....){ rotateStartPoint = pos //save the start rotation position //calculates and saves the start angle rotateStartAngle = mathLib.angleFromPoints(commandInitialPos, rotateStartPoint) rectP0aux = re.p0 // here I just saving the rectangle initiall position vertexs rectP1aux = re.p1 rectP2aux = re.p2 rectP3aux = re.p3 } https://bitbucket.org/joaodeusmorgado/techdrawstudio/src/142960ab5c809ddcbd20fb40f294e01d85c850d5/qml/qmlEntities/RectangleThick.qml#lines-75 onCommandMtm: function(pos, ....){//this is equivalent to mouse move rotateUpdateAngle = mathLib.angleFromPoints(commandInitialPos, pos) var angle = rotateUpdateAngle - rotateStartAngle // lets do it baby, lets rotate it, yeahhhh, updates the rectangles vertices, which is the rotation re.p0 = mathLib.rotate2DFromPoint(commandInitialPos, angle, rectP0aux) re.p1 = mathLib.rotate2DFromPoint(commandInitialPos, angle, rectP1aux) re.p2 = mathLib.rotate2DFromPoint(commandInitialPos, angle, rectP2aux) re.p3 = mathLib.rotate2DFromPoint(commandInitialPos, angle, rectP3aux) } https://bitbucket.org/joaodeusmorgado/techdrawstudio/src/142960ab5c809ddcbd20fb40f294e01d85c850d5/mathlib.cpp#lines-103 QVector3D MathLib::rotate2DFromPoint(const QVector3D &center, const float &angle, const QVector3D &p) const { float cosAngle = qCos(angle); float sinAngle = qSin(angle); float x = cosAngle*p.x() - sinAngle*p.y() + center.x() - cosAngle*center.x() + sinAngle*center.y(); float y = sinAngle*p.x() + cosAngle*p.y() + center.y() - sinAngle*center.x() - cosAngle*center.y(); return QVector3D(x, y, p.z()); } This is the rectangle rotating: [image: x7eha2y]
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    5 Views
    No one has replied
  • Is it possible to pop a mainformwidget in and out of a Tab widget?

    Unsolved
    12
    0 Votes
    12 Posts
    1k Views
    V
    @visinet After some more playing with tabifyDockWidget, I got it figured out and working. I just always use the main/first dockwidget as the first parameter and the newly dynamically created dockwidget as the second. When I was originally looking at the tabifyDockWidget function I just wasn't understanding the concept. Thanks again.
  • How to choose a set of plug-in libraries depending on the selected Kit

    Solved
    2
    0 Votes
    2 Posts
    157 Views
    8Observer88
    I found a solution here: Qt .pro file get Qtkit name CONFIG("windows") { INCLUDEPATH += $$PWD/libs/openal-soft-desktop-1.23.1/include LIBS += -L$$PWD/libs/openal-soft-desktop-1.23.1/lib/x64 LIBS += -lOpenAL32.dll } CONFIG("armeabi-v7a") { INCLUDEPATH += $$PWD/libs/openal-soft-android/include contains(ANDROID_TARGET_ARCH, armeabi-v7a) { ANDROID_EXTRA_LIBS += $$PWD/jniLibs/armeabi-v7a/libopenal.so } } CONFIG("x86_64") { INCLUDEPATH += $$PWD/libs/openal-soft-android/include contains(ANDROID_TARGET_ARCH, x86_64) { ANDROID_EXTRA_LIBS += $$PWD/jniLibs/x86_64/libopenal.so } }
  • How to write a data into csv file colmn by column

    Unsolved
    2
    0 Votes
    2 Posts
    207 Views
    JonBJ
    @swapna-v There isn't much to say. Build each line output as comma-separated values from the columns.in a loop. No reason for it to stop at 2 columns, and nobody can say why you say "printing continuously". Your output seems to show you are saving columns as multiple lines. You don't show your produced CSV file, you don't show the code you write.