Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.7k Posts
  • QPainter draw semi-transparent overlay watermark changes lines underneath in PDF

    Unsolved
    1
    0 Votes
    1 Posts
    237 Views
    No one has replied
  • Error reporting in a custom Qt-based plugin system: exceptions or getLastError?

    Unsolved
    1
    0 Votes
    1 Posts
    165 Views
    No one has replied
  • Qt 6.5.2 Linux Static Compile library problem

    Unsolved
    3
    0 Votes
    3 Posts
    824 Views
    SGaistS
    Hi, Maybe this article will be of interest. Hope it helps
  • QPainter and QStyleSheet

    Unsolved
    4
    0 Votes
    4 Posts
    513 Views
    M
    @Vlad02 Note: If you subclass a custom widget from QWidget, then in order to use the StyleSheets you need to provide a paintEvent to the custom widget : void CustomWidget::paintEvent(QPaintEvent* event) { QStyleOption opt; opt.init(this); QPainter p(this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); QWidget::paintEvent(event); } https://wiki.qt.io/How_to_Change_the_Background_Color_of_QWidget Warning: Function setStyleSheet is particularly useful for demonstration purposes, where you want to show Qt's styling capabilities. Real applications should avoid it and use one consistent GUI style instead. As applicable to setStyle too. Agree 200%
  • MOC error LNK2019 for QMetaObject when import/export

    Solved
    1
    0 Votes
    1 Posts
    249 Views
    No one has replied
  • Query Regarding QXmlStreamReader API

    Solved
    11
    0 Votes
    11 Posts
    642 Views
    B
    @ChrisW67 Thanks Chris, this was the first time , I have posted a question on any forum. So because of this ,may be linguistic issue was there. I tried to put the my query as expressive as I can. Once again, Thanks Chris.
  • how to let VideoFrame paint from (0,0) when scale

    Solved
    2
    0 Votes
    2 Posts
    167 Views
    C
    @Quiccz Compute the size that the video should scale to with aspect ratio preserved then paint it (without Qt::KeepAspectRatio) using that size and not the frame dimension.
  • 0 Votes
    12 Posts
    599 Views
    X
    @mpergand @Christian-Ehrlicher @JoeCFD @jsulm Finally, I use the following code to change widget size. Even I use same value of "min-width" and "max-width", it only affect the widget size, but the real widget size measured is not my value. void StepRepeatButton::updateStyle() { auto qssStyle = "color: rgba(0, 0, 0, 255);" " border: 1px solid gray;" "font-size: 9px;" "padding: 2px 2px;" "border-radius: 3px;" "min-height: 10px;" "min-width: 25px;" "max-height: 40px;" "max-width: 60px;"; if (m_helper->isCurrentUnit(m_unitIndex, m_deviceIndex)) { qssStyle = "color: rgba(0, 0, 255, 255);" " border: 3px solid blue;" "font-size: 9px;" "padding: 2px 2px;" "border-radius: 3px;" "min-height: 10px;" "min-width: 25px;" "max-height: 40px;" "max-width: 60px;"; } setQssStyle(m_helper->getUnitColor(m_unitIndex, m_deviceIndex) + qssStyle); }
  • How to replace QScript in QT6

    Unsolved
    2
    0 Votes
    2 Posts
    534 Views
    M
    @TGRSM Qt6 has QJSEngine instead https://doc.qt.io/qt-6/topics-scripting.html
  • Qt Creator macOS lldb ENGINE RUN FAILED

    Unsolved
    1
    2 Votes
    1 Posts
    293 Views
    No one has replied
  • QOpenGLWidget Problem

    Unsolved
    4
    0 Votes
    4 Posts
    406 Views
    SGaistS
    With the code you posted, there's no way to know what RenderModel is so it might just be a value that does not do anything in your switch statement. You should start by simplifying your code and strip away all the complexity. Then start by adding the minimal amount of stuff to actually show something on the widget and only then add the loading of your file. On a side note, please use a clean style when writing your code. You are mixing TitleCase, camelCase and snake_case is the same code base which makes it quite painful to go through. Same goes for your variable naming.
  • Qt gRPC - get return value of a call asyncronously

    Unsolved
    2
    0 Votes
    2 Posts
    212 Views
    SGaistS
    Hi, Since the callback is a lambda, why don't you pass the reply to it the same way you do for this ?
  • how to create QChars dynamically??

    Unsolved qchart qcharts
    10
    0 Votes
    10 Posts
    1k Views
    JonBJ
    @timob256 There is nothing more to say. Code like the stuff you are using. Replace new QPushButton with code for new QChartView plus its own QChart as above.
  • Insertings rows into QSQlite database eats up all RAM Memory

    Unsolved
    5
    0 Votes
    5 Posts
    321 Views
    Christian EhrlicherC
    @JonB The QSqlQuery is on the stack when it's not static so... And the clear also happens on each new exec/prepare.
  • How to send args to MainWindow function

    Unsolved
    11
    0 Votes
    11 Posts
    936 Views
    J
    @CompSciDude Thanks, dude! I would stuck for long time if not your post
  • QFileDialog corrupted! QT bug?

    Unsolved
    2
    0 Votes
    2 Posts
    258 Views
    C
    @NeilWang said in QFileDialog corrupted! QT bug?: Exception thrown at (in QtGuiApplication3.exe): 0xC0000005: Access violation while reading location 0x0000000000000000 Almost certainly accessing a null, uninitialised, or otherwise invalid pointer. There is nothing in the code you have posted that is an obvious cause for that. Delete all the intermediate files and do a complete rebuild of the project. Run a debug build of your program in the debugger, reproduce the error, and then copy and paste the text of the stack backtrace. Also post the exact code you compiled referenced by the stack trace.
  • checkbox in floating menu (MainWindow ui)

    Unsolved
    6
    0 Votes
    6 Posts
    686 Views
    JonBJ
    @JacobNovitsky Exactly as I and @Pl45m4 wrote. As we said, I asked and tried just this maybe a year ago, and it does not work. Checkboxes do not work if the item is a sub-menu, they only work and are intended for use on an item which performs an action. Found the topic: Is a QMenu item supposed to be able to be checkable?
  • CMake issue

    Unsolved
    3
    0 Votes
    3 Posts
    240 Views
    sierdzioS
    @JacobNovitsky said in CMake issue: cmake_minimum_required(VERSION 3.5) Qt 6 requires cmake version 3.16. To fix your problem, I think you need to add this line: set(CMAKE_INCLUDE_CURRENT_DIR ON) It will automatically include path to current source dir.
  • can we define a std::thread on QThread

    Unsolved
    6
    0 Votes
    6 Posts
    780 Views
    S
    The only place where I could imagine a QThread to be slower than a std::thread is during creation/destruction. Once it is running, there is no difference. The default implementation of QThread starts a QEventLoop. There is a chance that you could start your own event loop inside a std::thread. Though Qt might use calls to check for the corresponding QThread of a QObject. You could certainly emit signals from a std::thread as these are "regular" functions calls. You might have to make sure that your connections are Qt::QueuedConnections. Both QThread and std::thread need to use the OSes underlying thread functions to control threads. So, if you want to wrap a std::thread into a QThread, a QThread is already wrapping a std::thread, but without the std::thread in the middle.
  • How to avoid ScrollBar ,I hope it appears only when necessary!

    Solved
    17
    0 Votes
    17 Posts
    1k Views
    S
    @XiaofengXu said in How to avoid ScrollBar ,I hope it appears only when necessary!: Itseems that Changing the size of the parent form can cause the size of the child form to change, but the opposite is not true. This observation is correct. Though you can use setMinimumSize() to force the parent to expand. The QScrollArea, however, prefers to scroll instead of extending. I am not sure if you can force the scroll area to only scroll vertically, but adjust horizontally to the size of its assigned widget.