Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.4k Topics 456.4k Posts
  • Integrating Unity 3D into QT .

    Unsolved
    1
    0 Votes
    1 Posts
    463 Views
    No one has replied
  • What to do when Qt Linguist give warning ?

    Solved
    5
    0 Votes
    5 Posts
    293 Views
    Q
    @JonB Yes by writing %%100 in translation removed warning
  • Building Qt creator from source using mingw

    Unsolved
    7
    0 Votes
    7 Posts
    460 Views
    A
    @Christian-Ehrlicher Ok I'll try, I'll inform as soon as there will be a result
  • Issue with QLabel alignment properties

    Solved
    4
    0 Votes
    4 Posts
    217 Views
    Pl45m4P
    @CLBSII You're welcome. What you did is, you centered the pixmap on your QLabel, but the label itself still had the QScrollArea- widget default alignment, which is topLeft :)
  • This topic is deleted!

    Unsolved
    2
    0 Votes
    2 Posts
    27 Views
  • How to replace QWidget name dynamically with variable

    Solved
    16
    0 Votes
    16 Posts
    3k Views
    jsulmJ
    @qtnoob420 As I said: use real name of the attribute, not the word "attribute". Example: if you have attribute called "a" then do: a_dict[attribute] = self.dlg.a But it seems that you only have strings containing attribute names, right? Then you could do it like this: f = getattr(self.dlg, attribute) f() # Here we call attribute You do not even need a dictionary. One example for string in Python: s="abc" f=getattr(s, "upper") f() # prints ABC
  • Instancing multiple QLabels holding images and moving them independently

    Unsolved
    5
    0 Votes
    5 Posts
    342 Views
    jsulmJ
    @Gladiu said in Instancing multiple QLabels holding images and moving them independently: then how do i go about putting them on my window? You simply pass the parent widget (the one where the widget you're adding should be located) as parent: Qlabel label = new Qlabel("My cool label", this); // this is the parent here No need for addWidget.
  • 0 Votes
    4 Posts
    340 Views
    jsulmJ
    @CEO @mrjj already wrote a line of code. What other code do you need?
  • QComboBox keep currentText after model update

    Solved qcombobox model widgets
    2
    0 Votes
    2 Posts
    594 Views
    O
    The problem arises from the usage of the method m_model.setStringList(). The latter always clear the previous data, hence the index always reset upon its call. Solution: Use m_model.setStringList() only in the constructor to init the model. After that manually insert the row on the model and set the data for the respective row. This can be achieved with a simple modification in the slot method. MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) { ui->setupUi(this); m_model.setStringList({"1","2"}); ui->comboBox->setModel(&model); } void MainWindow::on_pushButton_clicked() { m_model.insertRow(model.rowCount()); m_model.setData(model.index(model.rowCount()-1), "3"); } In the example above, "3" is appended to the list model without changing the current index from the QComboBox.
  • Can form widgets be (easily) renumbered in QTDesigner ?

    Solved
    7
    0 Votes
    7 Posts
    528 Views
    VRoninV
    @AnneRanch changes in the template will automatically fall through to the widgets using it
  • How to do condition compilation in .pro file?

    Unsolved
    5
    0 Votes
    5 Posts
    1k Views
    SGaistS
    You can add a custom compiler like shown here.
  • how to resolve error of qmutex.h?

    Unsolved
    17
    0 Votes
    17 Posts
    5k Views
    Christian EhrlicherC
    @SocketSackett said in how to resolve error of qmutex.h?: In general, companies file bug reports with other companies. I don't understand - you want that TQtC fills a bug report for every IDE or compiler where completely valid code does not compile or give any other errors/warnings?
  • Automated testing recomendations

    Unsolved testing gtest qttest
    6
    0 Votes
    6 Posts
    1k Views
    SGaistS
    CTest is the test runner. Yes that's the starting point. Then you can have separated functional tests where you validate the high level functionalities and finally integration tests where you ensure that the final application is working as expected.
  • Generate a report with qt

    Unsolved
    9
    0 Votes
    9 Posts
    1k Views
    SGaistS
    Hi, Change the font size ? Without knowing how you create the report it's pretty hard to give you hints.
  • QtCharts sucks

    Unsolved
    5
    1 Votes
    5 Posts
    715 Views
    VRoninV
    KDChart is another alternative but once again it's GPL or Commercial Charting is a hard task with so many possible customisations. In the past I cheated my way out of this problem using QWebEngineView and Google Charts (Box and whiskers example).
  • read a write a XML file withe QXmlStreamWriter/QXmlStreamReader

    Solved
    4
    0 Votes
    4 Posts
    635 Views
    A
    @mrjj , thank you for your response , i found the exemple very usfule , @VRonin, i resolved the probleme , juste may program it's note optimized , becouse i have a lote of condition , thanks anyways for the curios QString sFilePath = QFileDialog::getOpenFileName(this, tr("Open XML File ..."), "E:/", tr("XMLFile (*.xml)")); if(sFilePath.isEmpty()) { QMessageBox::critical(this, tr("Open File XML"), tr("the file is empty !")); return; } QFileInfo fileInfo(sFilePath); QString sFileXmlName = fileInfo.fileName(); // XML object QXmlStreamReader reader; //Fichier XML QFile fFileXml(sFilePath); //open XML on red only if(!fFileXml.open(QFile::ReadOnly | QFile::Text)) { QMessageBox::critical(this, tr("Open File XML"), tr("the file is not open !"), QMessageBox::Ok); return; } if (reader.readNextStartElement()) { if (reader.name() == "Calib"){ while(reader.readNextStartElement()){ if(reader.name() == "CalibPt"){ while(reader.readNextStartElement()){ if(reader.name() == "calib"){ QString s = reader.readElementText(); ui->lineEdit_19->setText(s); } else if(reader.name() == "conv_"){ QString s = reader.readElementText(); ui->spinBox_1->setValue(s. toInt()); } else if(reader.name() == "conv_1"){ QString s = reader.readElementText(); ui->lineEdit->setText(s); } else if(reader.name() == "calib_1"){ QString s = reader.readElementText(); ui->lineEdit_9->setText(s); } else if(reader.name() == "conv_2"){ QString s = reader.readElementText(); ui->lineEdit_2->setText(s); } else if(reader.name() == "calib_2"){ QString s = reader.readElementText(); ui->lineEdit_10->setText(s); } else if(reader.name() == "conv_3"){ QString s = reader.readElementText(); ui->lineEdit_3->setText(s); } else if(reader.name() == "calib_3"){ QString s = reader.readElementText(); ui->lineEdit_11->setText(s); } else if(reader.name() == "conv_4"){ QString s = reader.readElementText(); ui->lineEdit_4->setText(s); } else if(reader.name() == "calib_4"){ QString s = reader.readElementText(); ui->lineEdit_12->setText(s); } else if(reader.name() == "conv_5"){ QString s = reader.readElementText(); ui->lineEdit_5->setText(s); } else if(reader.name() == "calib_5"){ QString s = reader.readElementText(); ui->lineEdit_13->setText(s); } else if(reader.name() == "conv_6"){ QString s = reader.readElementText(); ui->lineEdit_6->setText(s); } else if(reader.name() == "calib_6"){ QString s = reader.readElementText(); ui->lineEdit_14->setText(s); } else if(reader.name() == "conv_7"){ QString s = reader.readElementText(); ui->lineEdit_7->setText(s); } else if(reader.name() == "calib_7"){ QString s = reader.readElementText(); ui->lineEdit_15->setText(s); } else if(reader.name() == "conv_8"){ QString s = reader.readElementText(); ui->lineEdit_8->setText(s); } else if(reader.name() == "calib_8"){ QString s = reader.readElementText(); ui->lineEdit_16->setText(s); } else reader.skipCurrentElement(); } } else reader.skipCurrentElement(); } } else reader.raiseError(QObject::tr(".")); } I have to change the names of the subchild, otherwise it will not work.
  • RPC server unavailable

    Solved
    2
    0 Votes
    2 Posts
    1k Views
    JonBJ
    @SPlatten Unless you know better than I or see any problems occurring: so far as I know, first chance exceptions occur "naturally" and can be ignored. Debuggers report them, VS used to do so all the time, you don't have to worry. It is probably happening down in the guts of the file dialog code for getting stuff to display, e.g. maybe looking at network (but that's only a guess). And just btw, RCP server unavailable is not the right title: you are looking at an RPC server, which is quite different from RCP :) Better title now :)
  • QTableView, QSortFilterProxyModel row selection

    Solved
    4
    0 Votes
    4 Posts
    1k Views
    VRoninV
    @SPlatten said in QTableView, QSortFilterProxyModel row selection: is there an example which demonstrates how to use these? const QItemSelection proxySelect = mptvSDrecs->selectionModel()->selection(); QModelIndexList objIndexes = mpsfpSDmodel->mapSelectionToSource(proxySelect)->indexes();
  • 0 Votes
    2 Posts
    135 Views
    raven-worxR
    @Yina no this iss not possible. For example in general the connection can either be established via USB or simple GPIOs. If you know its connected via USB you need to use some usb library or the platforms native API for example to get such information.
  • Using Qt for Medical device development

    Solved
    3
    0 Votes
    3 Posts
    306 Views
    S
    Thanks @JKSH for the clarification :)