Skip to content
QtWS25 Last Chance
  • 0 Votes
    19 Posts
    2k Views
    S
    @Chris-Kawa thank you very much. That definitely helped a lot. :) I have done the manual positioning now, so all delegates line up with the actual widget. :) void ViewLayerItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const { QStyleOptionViewItem opt = option; initStyleOption(&opt, index); // Überprüfen Sie, ob der aktuelle Index bearbeitet wird if (index == currentlyEditedIndex) { return; } // Setzen Sie die Werte der SpinBox und CheckBox basierend auf den Modellwerten QString lineEditvalue = index.model()->data(index, Qt::EditRole).toString(); bool checkBoxValue = index.model()->data(index, Qt::CheckStateRole).toBool(); // Laden Sie das Icon und skalieren Sie es QPixmap iconPixmap("://resource/quick.png"); // Ersetzen Sie dies durch den Pfad zu Ihrer Icon-Datei QPixmap scaledPixmap = iconPixmap.scaled(32, 32, Qt::KeepAspectRatio, Qt::SmoothTransformation); // Berechnen Sie die Position für das Icon int centerY = option.rect.top() + option.rect.height() / 2; int iconY = centerY - scaledPixmap.height() / 2; QPoint iconPos = QPoint(option.rect.left() + 10, iconY); // Zeichnen Sie das Pixmap mit dem QPainter painter->drawPixmap(iconPos, scaledPixmap); // Berechnen Sie die Position und Größe für das LineEdit QRect lineEditRect = option.rect; lineEditRect.setLeft(iconPos.x() + scaledPixmap.width() + 10); // Adjust as needed lineEditRect.setRight(option.rect.right() - 10); // Adjust as needed // Erstellen Sie ein QStyleOptionFrame für das LineEdit QStyleOptionFrame lineEditOption; lineEditOption.lineWidth = 1; // Setzen Sie die Liniendicke auf 1 lineEditOption.rect = lineEditRect; // Zeichnen Sie das LineEdit QApplication::style()->drawControl(QStyle::CE_ShapedFrame, &lineEditOption, painter); // Zeichnen Sie den Text des LineEdits painter->drawText(lineEditOption.rect.adjusted(2,0,0,0), Qt::AlignLeft | Qt::AlignVCenter, lineEditvalue); // Berechnen Sie die Position und Größe für die CheckBox QRect checkBoxRect = option.rect; checkBoxRect.setLeft(lineEditRect.right() - 22); // Adjust as needed checkBoxRect.setRight(option.rect.right() - 10); // Adjust as needed // Erstellen Sie ein QStyleOptionButton für die CheckBox QStyleOptionButton checkBoxOption; checkBoxOption.state = checkBoxValue ? QStyle::State_On : QStyle::State_Off; checkBoxOption.rect = checkBoxRect; // Zeichnen Sie die CheckBox QApplication::style()->drawControl(QStyle::CE_CheckBox, &checkBoxOption, painter); }
  • 0 Votes
    5 Posts
    845 Views
    P
    @SGaist said in QMenu And QSqlQueryModel translation problem !: QEvent::LanguageChange @ SGaist Hi bro <3 i didn't know about QEvent::LanguageChange before really thank you, i will check it <3
  • 0 Votes
    1 Posts
    300 Views
    No one has replied
  • 0 Votes
    5 Posts
    897 Views
    A
    @kkoehne said in QDoc doesn't generate all the documentation.: MMh .. sounds indeed that something goes wrong here, then. Can you create a somewhat minimal example, and open a bug report at https://bugreports.qt.io/projects/QTBUG, component 'Build tools: qdoc'? Sure! I'll prepare something. Maybe it's a particular configuration that leads to some kind of problem. Thanks a lot in advance. I'll keep you posted :-)!
  • 0 Votes
    3 Posts
    428 Views
    JonBJ
    @afalco said in Possible bug in QSplitter: sizes set can't be read back: But the sizes I get back from QSplitter::sizes() are not the one I set, unless I visit the tab. Qt sizes are only reported correctly once a widget is shown.
  • Petite problématique avec QtNetwork

    Unsolved French qtnetwork ftp ftp repository problem
    5
    0 Votes
    5 Posts
    1k Views
    KroMignonK
    @Vincent66 Bonjour, QTfp ne fait plus parti du project Qt mais les sources restes accessibles sur GitHub ==> https://github.com/qt/qtftp Pourquoi ne pas simplement partir de là et faire les adaptations eventuellement nécessaire pour la compilation?
  • 0 Votes
    4 Posts
    1k Views
    T
    Ok i found the problem i just forgot to put the config file in my Deployment folder. Thanks for the help @jsulm .
  • 0 Votes
    15 Posts
    3k Views
    JonBJ
    @Rameshwar @J-Hilk has given you the necessary code to start from. That's why people type in answers to questions. First try that and verify it works. Then change it so that it writes on your mainwindow or whatever you want instead. Only after that, write back if you can't get what you want working.
  • Two durations of QMediaPlayer file

    Unsolved General and Desktop qmediaplayer problem
    3
    1 Votes
    3 Posts
    864 Views
    N
    Thank you for the greeting. The file is working fine with the other players (VLC, Windows 10 player).
  • 0 Votes
    4 Posts
    1k Views
    A
    Fill all results of checked check boxes into a list, and then take the first n entries from that list (up to the number you need, or the size of the list) EDIT: If you put the checkboxes into a container, you just have to loop over it
  • Deploy QT Application on any mac

    Solved General and Desktop mac os x deploying problem
    5
    0 Votes
    5 Posts
    2k Views
    E
    @J.Hilk said in Deploy QT Application on any mac: macdeploy Yes you saved my life ! Works perfectly, thanks ! I had to change @rpath to @executablepath tho This link helped me doing it if someone has the same problem one day https://stackoverflow.com/questions/2809930/macdeployqt-and-third-party-libraries
  • Modbus problem, beginner

    Solved General and Desktop modbus serial problem new beginner
    10
    0 Votes
    10 Posts
    5k Views
    G
    Thanks for the answers, I found the connection problem. I added the part: void MainWindow::on_connectType_currentIndexChanged(int index) { if (modbusDevice) { modbusDevice->disconnectDevice(); delete modbusDevice; modbusDevice = nullptr; } auto type = static_cast<ModbusConnection> (index); if (type == Serial) { modbusDevice = new QModbusRtuSerialMaster(this); } else if (type == Tcp) { modbusDevice = new QModbusTcpClient(this); if (ui->portEdit->text().isEmpty()) ui->portEdit->setText(QLatin1Literal("127.0.0.1:502")); } connect(modbusDevice, &QModbusClient::errorOccurred, [this](QModbusDevice::Error) { statusBar()->showMessage(modbusDevice->errorString(), 5000); }); if (!modbusDevice) { ui->connectButton->setDisabled(true); if (type == Serial) statusBar()->showMessage(tr("Could not create Modbus master."), 5000); else statusBar()->showMessage(tr("Could not create Modbus client."), 5000); } else { connect(modbusDevice, &QModbusClient::stateChanged, this, &MainWindow::onStateChanged); } } And now I can make a connection. Now I have to test it on the device, but i can't access it for a while, to be continued
  • Load Image From Db Problem

    Unsolved General and Desktop loading images database problem
    26
    0 Votes
    26 Posts
    12k Views
    KutyusK
    @VRonin Thank you for reply, but my problem is the load image from database, please see my another question: QT 5.8 image from database error
  • Connect To sqlServer Database Problem

    Solved General and Desktop sqlserver database problem
    12
    0 Votes
    12 Posts
    5k Views
    M4RZB4NiM
    @hskoglund Thank You So much man My Problem Solved!
  • 0 Votes
    2 Posts
    1k Views
    develop-itD
    To complete, i tried to configure the settings and i have the output of the cross compile who say me TERM environment variable not set. The cross compile is now standing something, but i don't know what because i've already set my TERM environnement → /usr/bin/xterm -e Thanks.
  • LineEdit .isEmpty() Problem

    Solved General and Desktop line edit empty problem qt 5.4.1
    4
    0 Votes
    4 Posts
    5k Views
    M4RZB4NiM
    @SGaist Thank You so much , My problem solved! :)
  • Create Settings Page Problem....

    Unsolved General and Desktop settings page problem
    4
    0 Votes
    4 Posts
    2k Views
    SGaistS
    Hi, Looks like you are trying to use a Ui_otherPage without setting it up. Why not use the widget you created with it ?
  • problem in using QPainterPath class??

    Unsolved General and Desktop qpainterpath problem extralines
    5
    0 Votes
    5 Posts
    2k Views
    stackprogramerS
    @Wieland it is example of Qt ,its name diagramscene thanks for reply
  • QSettings

    General and Desktop problem qsettings linux windows
    8
    0 Votes
    8 Posts
    2k Views
    L
    @mrjj "/home/denis/.config/newCompany/NotesManager.conf".It is path in Linux. "\HKEY_CURRENT_USER\Software\newCompany\NotesManager in windows