Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.5k Topics 457.3k Posts
  • QDESIGNER_WIDGET_EXPORT in NON plugin/library projects

    Unsolved
    3
    0 Votes
    3 Posts
    337 Views
    DragoonD
    @Christian-Ehrlicher said in QDESIGNER_WIDGET_EXPORT in NON plugin/library projects: There is no need to use this predefined macro but you can use an own the same way it's done for every other shared library as explained here. Then there is no need to define something when you use the library. Are you sure that the widget compiled without the predefined macro will be usable both on Windows and Linux? Because official Qt docs states here that you should use such macro. In my experience widgets classes need such macro to be usable as a QtCreator plugin but maybe I'm wrong. Anyway in my specific case I use my widget both as a precompiled library and as an include subproject in such a case QDESIGNER_WIDGET_EXPORT macro (on Windows systems) lead to compilation error and must be removed from widget class source. Since I don't want to edit the class source every time I need to use it I need to find a different approach. The approach used in the link you referenced doesn't seem to work for my case since it compiles correctly in case: DEFINES += MYSHAREDLIB_LIBRARY is present, but doesn't compile at all if it's not.. the error is something like that (repeated for every class method): warning C4273: 'CustomWidget::CustomWidget': inconsistent dll link To make it work I need to do something like that: #if defined(MYSHAREDLIB_LIBRARY) # define QDESIGNER_WIDGET_EXPORT Q_DECL_EXPORT #else # define QDESIGNER_WIDGET_EXPORT #endif That of course will lead to some "macro redefinition warning".
  • Avoiding multiple text selections

    Unsolved
    2
    0 Votes
    2 Posts
    283 Views
    J
    And of course, 5 minutes after asking, I found that I can connect my QApplication's focusChanged signal to something like def clear_selection(old, new): if isinstance(old, (QPlainTextEdit, QTextEdit)): cursor = old.textCursor() cursor.clearSelection() old.setTextCursor(cursor) I still wonder if there is a better way, though.
  • Error when including WebEngine

    Unsolved
    10
    0 Votes
    10 Posts
    2k Views
    jsulmJ
    @MEsc That could be, I think this was changed in Qt6.
  • Resizible Frameless Window visual artefacts

    Solved
    7
    0 Votes
    7 Posts
    942 Views
    FinchiF
    @Finchi After some time, I returned to this problem and the best thing I could think of was to make a special transparent widget on top of the main one to resize the main one without visual artifacts. For those who are interested, here is the link to github Perhaps this code will be useful to those who have a similar problem.
  • I want to load the results of the query all at once.

    Unsolved
    9
    0 Votes
    9 Posts
    549 Views
    jsulmJ
    @meria0503 said in I want to load the results of the query all at once.: This Excel library does not support QTableview What does QTableview or QTableWidget have to do with Excel "library" (whatever library you mean, I don't know)?! You're anyway simply executing a SQL query and then MANUALLY adding all the records into QTableWidget. It is way better to use QTableview...
  • how to update gcc version 4.9.1 below 11, to 5 = 17

    Unsolved
    4
    0 Votes
    4 Posts
    434 Views
    jsulmJ
    @kapabahwuk If you want to use Qt then you should use MinGW compiler provided by Qt installer. You can add any compiler in QtCreator "Tools/Options.../Kits/Compilers. Then create a Kit and set that compiler in the Kit.
  • How can I handle the interrupt when the interrupt occurs in the MouseArea?

    Unsolved
    2
    0 Votes
    2 Posts
    165 Views
    Pl45m4P
    @Kelldim said in How can I handle the interrupt when the interrupt occurs in the MouseArea?: If the onPositionChanged is interrupted Interrupted? In which way? You mean "triggered"?
  • Unable to click pushbutton when progress bar is running.

    Unsolved
    2
    0 Votes
    2 Posts
    157 Views
    Pl45m4P
    @Ramkumar-Mohan And what should we do now without any other information what you have done? You are probably blocking your main thread / eventLoop, with the stuff that's going on while the progressBar is proceeding.
  • How to include Qt 5.0 library like in Qt 6 ? Example Qt::AA_EnableHighDpiScaling

    Unsolved
    2
    0 Votes
    2 Posts
    185 Views
    jsulmJ
    @kapabahwuk Please ask understandable questions! You include Qt5 libs the same way you include Qt6 libs. If it does not work then please explain better what you did and what happens...
  • QNetworkRequest::setMaximumRedirectsAllowed

    Unsolved
    3
    0 Votes
    3 Posts
    168 Views
    jsulmJ
    @kapabahwuk There is Qt documentation for a reason...
  • panic: assignment to entry in nil map

    Unsolved
    3
    0 Votes
    3 Posts
    291 Views
    C
    <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> <class>MainWindow</class> <widget class="QMainWindow" name="MainWindow"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>658</width> <height>812</height> </rect> </property> <property name="windowTitle"> <string>计算器</string> </property> <property name="styleSheet"> <string notr="true">background-color: #2D2926;</string> </property> <widget class="QWidget" name="centralwidget"> <widget class="QTextBrowser" name="result_text_browser"> <property name="geometry"> <rect> <x>20</x> <y>10</y> <width>611</width> <height>121</height> </rect> </property> <property name="styleSheet"> <string notr="true">border:0;</string> </property> </widget> <widget class="QPushButton" name="ac_button"> <property name="geometry"> <rect> <x>20</x> <y>150</y> <width>100</width> <height>100</height> </rect> </property> <property name="styleSheet"> <string notr="true">border:2px solid #808080; color: rgb(169, 169, 169); font: 40pt ; border-radius:50px; background-color:#C0C0C0; </string> </property> <property name="text"> <string>AC</string> </property> </widget> <widget class="QPushButton" name="negate_button"> <property name="geometry"> <rect> <x>170</x> <y>150</y> <width>100</width> <height>100</height> </rect> </property> <property name="styleSheet"> <string notr="true">border:2px solid #808080; color: rgb(169, 169, 169); border-radius:50px; font: 40pt ; background-color:#C0C0C0;</string> </property> <property name="text"> <string>+/-</string> </property> </widget> <widget class="QPushButton" name="percentage_button"> <property name="geometry"> <rect> <x>330</x> <y>150</y> <width>100</width> <height>100</height> </rect> </property> <property name="styleSheet"> <string notr="true">border:2px solid #808080; color: rgb(169, 169, 169); border-radius:50px; font: 40pt ; background-color:#C0C0C0;</string> </property> <property name="text"> <string>%</string> </property> </widget> <widget class="QPushButton" name="divide_tutton"> <property name="geometry"> <rect> <x>500</x> <y>150</y> <width>100</width> <height>100</height> </rect> </property> <property name="styleSheet"> <string notr="true">border:2px solid #808080; color: rgb(169, 169, 169); border-radius:50px; background-color:#FFA500; font: 40pt ;</string> </property> <property name="text"> <string>÷</string> </property> </widget> <widget class="QPushButton" name="eight_button_8"> <property name="geometry"> <rect> <x>170</x> <y>280</y> <width>100</width> <height>100</height> </rect> </property> <property name="styleSheet"> <string notr="true">border:2px solid #808080; color: rgb(169, 169, 169); border-radius:50px; background-color:#808080; font: 35pt ;</string> </property> <property name="text"> <string>8</string> </property> </widget> <widget class="QPushButton" name="x_button"> <property name="geometry"> <rect> <x>500</x> <y>280</y> <width>100</width> <height>100</height> </rect> </property> <property name="styleSheet"> <string notr="true">border:2px solid #FFA500; color: rgb(169, 169, 169); border-radius:50px; background-color:#FFA500; font: 40pt ;</string> </property> <property name="text"> <string>X</string> </property> </widget> <widget class="QPushButton" name="seven_button_7"> <property name="geometry"> <rect> <x>20</x> <y>280</y> <width>100</width> <height>100</height> </rect> </property> <property name="styleSheet"> <string notr="true">border:2px solid #808080; color: rgb(169, 169, 169); border-radius:50px; background-color:#808080; font: 35pt ;</string> </property> <property name="text"> <string>7</string> </property> </widget> <widget class="QPushButton" name="nine_button_9"> <property name="geometry"> <rect> <x>330</x> <y>280</y> <width>100</width> <height>100</height> </rect> </property> <property name="styleSheet"> <string notr="true">border:2px solid #808080; color: rgb(169, 169, 169); border-radius:50px; background-color:#808080; font: 35pt ;</string> </property> <property name="text"> <string>9</string> </property> </widget> <widget class="QPushButton" name="five_button_5"> <property name="geometry"> <rect> <x>170</x> <y>410</y> <width>100</width> <height>100</height> </rect> </property> <property name="styleSheet"> <string notr="true">border:2px solid #808080; color: rgb(169, 169, 169); border-radius:50px; background-color:#808080; font: 35pt ;</string> </property> <property name="text"> <string>5</string> </property> </widget> <widget class="QPushButton" name="sub_button"> <property name="geometry"> <rect> <x>500</x> <y>410</y> <width>100</width> <height>100</height> </rect> </property> <property name="styleSheet"> <string notr="true">border:2px solid #808080; color: rgb(169, 169, 169); border-radius:50px; background-color:#FFA500; font: 40pt ;</string> </property> <property name="text"> <string>-</string> </property> </widget> <widget class="QPushButton" name="four_button_4"> <property name="geometry"> <rect> <x>20</x> <y>410</y> <width>100</width> <height>100</height> </rect> </property> <property name="styleSheet"> <string notr="true">border:2px solid #808080; color: rgb(169, 169, 169); border-radius:50px; background-color:#808080; font: 35pt ;</string> </property> <property name="text"> <string>4</string> </property> </widget> <widget class="QPushButton" name="six_button_6"> <property name="geometry"> <rect> <x>330</x> <y>410</y> <width>100</width> <height>100</height> </rect> </property> <property name="styleSheet"> <string notr="true">border:2px solid #808080; color: rgb(169, 169, 169); border-radius:50px; background-color:#808080; font: 35pt ;</string> </property> <property name="text"> <string>6</string> </property> </widget> <widget class="QPushButton" name="two_button_2"> <property name="geometry"> <rect> <x>170</x> <y>540</y> <width>100</width> <height>100</height> </rect> </property> <property name="styleSheet"> <string notr="true">border:2px solid #808080; color: rgb(169, 169, 169); border-radius:50px; background-color:#808080; font: 35pt ;</string> </property> <property name="text"> <string>2</string> </property> </widget> <widget class="QPushButton" name="add_button"> <property name="geometry"> <rect> <x>500</x> <y>540</y> <width>100</width> <height>100</height> </rect> </property> <property name="styleSheet"> <string notr="true">border:2px solid #808080; color: rgb(169, 169, 169); border-radius:50px; background-color:#FFA500; font: 40pt ;</string> </property> <property name="text"> <string>+</string> </property> </widget> <widget class="QPushButton" name="one_button_1"> <property name="geometry"> <rect> <x>20</x> <y>540</y> <width>100</width> <height>100</height> </rect> </property> <property name="styleSheet"> <string notr="true">border:2px solid #808080; color: rgb(169, 169, 169); border-radius:50px; background-color:#808080; font: 35pt ;</string> </property> <property name="text"> <string>1</string> </property> </widget> <widget class="QPushButton" name="three_button_3"> <property name="geometry"> <rect> <x>330</x> <y>540</y> <width>100</width> <height>100</height> </rect> </property> <property name="styleSheet"> <string notr="true">border:2px solid #808080; color: rgb(169, 169, 169); border-radius:50px; background-color:#808080; font: 35pt ;</string> </property> <property name="text"> <string>3</string> </property> </widget> <widget class="QPushButton" name="equal_button"> <property name="geometry"> <rect> <x>500</x> <y>660</y> <width>100</width> <height>100</height> </rect> </property> <property name="styleSheet"> <string notr="true">border:2px solid #808080; color: rgb(169, 169, 169); border-radius:50px; background-color:#FFA500; font: 40pt ;</string> </property> <property name="text"> <string>=</string> </property> </widget> <widget class="QPushButton" name="zero_button_0"> <property name="geometry"> <rect> <x>20</x> <y>660</y> <width>241</width> <height>100</height> </rect> </property> <property name="styleSheet"> <string notr="true">border:2px solid #808080; color: rgb(169, 169, 169); border-radius:50px; background-color:#808080; font: 35pt ;</string> </property> <property name="text"> <string>0</string> </property> </widget> <widget class="QPushButton" name="point_button"> <property name="geometry"> <rect> <x>330</x> <y>660</y> <width>100</width> <height>100</height> </rect> </property> <property name="styleSheet"> <string notr="true">border:2px solid #808080; font: 13pt ; color: rgb(169, 169, 169); border-radius:50px; background-color:#808080; font: 35pt,Bold ;</string> </property> <property name="text"> <string>.</string> </property> </widget> </widget> <widget class="QMenuBar" name="menubar"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>658</width> <height>24</height> </rect> </property> </widget> <widget class="QStatusBar" name="statusbar"/> </widget> <resources/> <connections/> </ui>
  • How to deploy below with command line

    Unsolved
    3
    0 Votes
    3 Posts
    234 Views
    K
    @Christian-Ehrlicher solved, ty
  • QGraphics and Text

    Unsolved
    7
    0 Votes
    7 Posts
    774 Views
    C
    @sevi78 I found something interesting when I searched for qt game development. Qt Game Engine (QGE) It's a bit old but it might give you ideas even if it does not work for you. here's the link: Qt Game Engine You should also check out games that were made with Qt.
  • QAudioSink buffer size changes

    Unsolved
    4
    0 Votes
    4 Posts
    550 Views
    SGaistS
    @Dan-Lyke a quick look at your code reminded me of another project where latency was crucial and I wrote a QIODevice subclass on top of PortAudio which might be better suited for your use case. On a side note, your custom mutex locker class is not necessary since there's QMutexLocker.
  • QTcpSocket connecting even to no server!

    Solved
    3
    0 Votes
    3 Posts
    260 Views
    D
    @Christian-Ehrlicher thank's very much ^^ It works fine now
  • QTcpSocket connecting even tho no server?

    Unsolved
    28
    0 Votes
    28 Posts
    5k Views
    D
    @Christian-Ehrlicher as previously suggested I created my own topic here
  • lose precesion when qtreeview show double value

    Solved
    8
    0 Votes
    8 Posts
    446 Views
    W
    @Chris-Kawa thank for ur explaination. after custom my delegate , i solved this problem.[image: pp3lToj.jpg] and when click double value item, should reimplement setEditorData function to specify the format,otherwise the double value will shrink too. below is my key code,hope it helps someone else. QWidget* XtrTaskViewDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const { return QStyledItemDelegate::createEditor(parent, option, index); } void XtrTaskViewDelegate::setEditorData(QWidget* editor, const QModelIndex& index) const { if (index.data().type() == QVariant::Double) { QDoubleSpinBox* doubleSpinBox = static_cast<QDoubleSpinBox*>(editor); doubleSpinBox->setDecimals(10); doubleSpinBox->setValue(index.data().toDouble()); } else { QStyledItemDelegate::setEditorData(editor, index); } }
  • 0 Votes
    1 Posts
    325 Views
    No one has replied
  • Why setting background color of QLineEdit has no effect?

    Solved
    6
    0 Votes
    6 Posts
    5k Views
    mrjjM
    @Sakhana99 It would then be good to list what platform(lin,win,mac) and what Qt version(Qt5.13,Qt6 etc) you are trying this on as things change in 7 years :)
  • Qml Videoouput only display with sudo

    Unsolved
    2
    0 Votes
    2 Posts
    211 Views
    Y
    I find QMLSCENE_DEVICE=softwarecontext in my OS,VideoOuput cannot use software to render. Qt Quick Software Adaptation