Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.7k Posts
  • QNetworkRequest::setMaximumRedirectsAllowed

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

    Unsolved
    3
    0 Votes
    3 Posts
    300 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
    245 Views
    K
    @Christian-Ehrlicher solved, ty
  • QGraphics and Text

    Unsolved
    7
    0 Votes
    7 Posts
    820 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
    564 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
    268 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
    475 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
    338 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
    232 Views
    Y
    I find QMLSCENE_DEVICE=softwarecontext in my OS,VideoOuput cannot use software to render. Qt Quick Software Adaptation
  • QDataStream >> uin64_t

    Solved
    9
    0 Votes
    9 Posts
    1k Views
    Christian EhrlicherC
    @ikuris said in QDataStream >> uin64_t: So this is the reason why it does compile on Windows Already explained: unsigned long long != unsigned long int
  • How can one use Qt Media Player to record user utterances and play it back?

    Unsolved
    3
    0 Votes
    3 Posts
    294 Views
    S
    @Bonnie : Thanks for the recommendations I will go through the documentation and see if I am able to get the recording and playback to work
  • MIL STD 1553 class creation

    Unsolved
    3
    0 Votes
    3 Posts
    461 Views
    E
    @ChrisW67 Thank you so much for fast response
  • Is there a version of QLinkedList in qt6

    Unsolved
    5
    0 Votes
    5 Posts
    2k Views
    B
    @GSG As noted in the QLinkedList documentation: Note: This class is obsolete, please use std::list instead. So it is Qt team's suggestion to use std::list to replace it.
  • QGraphicsView and some related problems

    Unsolved
    6
    0 Votes
    6 Posts
    525 Views
    SGaistS
    @masa4 said in QGraphicsView and some related problems: void MainWidget::DrawImage() { scene->clear(); if(!img.empty()){ img.convertTo(imgProcessed, -1, contrast, brightness); qimg = QImage(imgProcessed.data, imgProcessed.cols, imgProcessed.rows, imgProcessed.step, QImage::Format_Grayscale8); scaledQimg = qimg.scaled(ui->graphicsView->width() - 10, ui->graphicsView->height() - 10, Qt::KeepAspectRatio); if(isImageScaled) pixmap = QPixmap::fromImage(scaledQimg); else pixmap = QPixmap::fromImage(qimg); pix = scene->addPixmap(pixmap); ui->graphicsView->setScene(scene); } } There in the line where you call addPixmap. This create a new object every time. This answers question 1 For question 2, retry when you stopped adding all these objects. For question 3, do you mean you find complicated to manage two QImage objects ? Why are you creating two images and then selecting one of the two ? Move all the additional logic where it actually make sense then there's no need for multiple QImages. This will also avoid wasting CPU and RAM for nothing. For the bonus question, check the Gesture Overview in Qt's documentation
  • No Suitable Kits Found

    Unsolved
    6
    0 Votes
    6 Posts
    2k Views
    SGaistS
    @sajis just as I wrote: go to Qt Creator's settings.
  • Qt 6.5 beta 4

    Unsolved
    3
    0 Votes
    3 Posts
    228 Views
    F
    ok ! thanks SGaist.
  • QCustomPlot rounded corners stylesheet without border-radius

    Unsolved
    2
    0 Votes
    2 Posts
    711 Views
    Pl45m4P
    @lukutis222 said in QCustomPlot rounded corners stylesheet without border-radius: From looking at the mainwindow.ui, I can see that the corners are rounded: However, when I build and run the application, corners are no longer rounded and the background color is not blue. This is what it looks like when the application is launched: Just because you've set a stylesheet to the widget in the place of QCustomPlot, it doesn't mean that the stylesheet is also applied to your plot. The same question was discussed in QCustomPlot forum here: https://www.qcustomplot.com/index.php/support/forum/1432 How come it shows up as rounded corners in mainwindow.ui Because QtDesigner is a "dumb" tool (not in terms of "bad", but it doesn't know about logic and the code you add later, when your widget is replaced with QCustomPlot) It's a WYSIWYG editor. When opening your mainWindow.ui in design mode, there is still just a plain QWidget, which is styled according to the stylesheet you've set. Something does not seem right, it feels like it is not applying the stylesheets properly. When rendering/painting the QCustomPlot, the stylesheet is probably ignored/not supported. For more information you should check the QCustomPlot documention and forum, since it's a third-party tool. https://www.qcustomplot.com/documentation/index.html Does it matter if this QCustomPlot widget is placed withing horizontal layout? Maybe that could be an issue? No, definitely not the issue.
  • MapPolyline

    Unsolved
    2
    0 Votes
    2 Posts
    214 Views
    Pl45m4P
    @Yaldiz By default you only can set the line color and line width. https://doc.qt.io/qt-5/qml-qtlocation-mappolyline.html#details