Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.5k Topics 456.8k Posts
  • 0 Votes
    5 Posts
    932 Views
    Christian EhrlicherC
    The QSqlTableModel needs a real PK, yes.
  • QScrollArea - minimum width controlled by content? - remove horizontal bars?

    Unsolved qscrollarea
    1
    0 Votes
    1 Posts
    202 Views
    No one has replied
  • How can I use QMessageBox::About differently

    Unsolved
    13
    0 Votes
    13 Posts
    1k Views
    A
    @HerrWinfried Customise QMessageBox with pixmap or icon QMessageBox *infoMSG = new QMessageBox(this); infoMSG->setMaximumSize(400,200); infoMSG->setStyleSheet("background-color: rgb(167, 210, 219); color:rgb(0,0,0);"); infoMSG->setIconPixmap(QPixmap(":/images/Green-true.png").scaled(QSize(30,30))); infoMSG->setWindowIcon(QIcon(":/images/Admin-logo.png")); infoMSG->setWindowTitle("Title"); infoMSG->setText("Message"); infoMSG->addButton(QMessageBox::Ok)->setMinimumSize(80,30); infoMSG->buttons().at(0)->setStyleSheet("background-color: rgb(255,153,153);color:rgb(0,0,102);"); infoMSG->exec();
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    4 Views
    No one has replied
  • What `--` is on MacOS?

    Solved configuration build
    2
    0 Votes
    2 Posts
    605 Views
    SGaistS
    Hi, AFAIK, it has nothing to do with macOS. Usually the -- means that what follows will by passed as is to a process started by the script / command / other that you are invoking.
  • Low Energy Bluetooth: Notifications not working

    Solved
    5
    2 Votes
    5 Posts
    2k Views
    S
    I also run now in this issue using Qt 5.15. I tried to send a command to a thermostate and expected an response from it. After using the workaround menthioned above everything works. Is there a plan to fix this or is it maybe already fixed in Qt > 6 ?
  • 0 Votes
    10 Posts
    1k Views
    C
    I solved my problem via event filter of scene. ui->graphicsView->scene()->installEventFilter(this); bool MainWindow::eventFilter(QObject* obj, QEvent* event){ if(event->type() == QEvent::GraphicsSceneMousePress){ if(ui->addServerBtn->isChecked()){ QGraphicsSceneMouseEvent* mouseSceneEvent; mouseSceneEvent = static_cast<QGraphicsSceneMouseEvent *>(event); Server *serv = new Server(mouseSceneEvent->scenePos().toPoint()); scene->addItem((QGraphicsPixmapItem*)serv); } } return false; }
  • 0 Votes
    2 Posts
    165 Views
    JonBJ
    @fi11222 Hello and welcome. If you have a question it is usual to write a few words of your own rather that only referencing some other thread. You can see there that you were asked to provide more details. Which right now you are doing. You need to produce the crash in the debugger and then post the stack trace (not something else), which you can find in its own window.
  • Height of menu item

    Solved
    9
    0 Votes
    9 Posts
    2k Views
    JonBJ
    @mpergand , @Chris-Kawa Thanks peeps. I know you are waiting to find out how I got on this Boxing day.... I used menuAboutToShow() signal and actionGeometry() there. This did indeed give me a correct height, and setting my widget's fixed height to that achieves what I wanted. There was one little wrinkle. My QWidgetAction is actually the (only) item on a QMenu sub-menu, i.e. an item which has the ... > to display a "slide-out" sub-menu. It is that whose height I want my QWidgetAction's widget to match. But QMenu::actionGeometry() requires a QAction to measure, there is no QMenu::subMenuGeometry() method. I made an educated guess to use QMenu::menuAction() and went for: const QRect &geom(ui->parentMenu->actionGeometry(ui->subMenu->menuAction())); which delivered what I needed. So I guess a for a QMenu sub-menu there is a "hidden" QAction which can be accessed via QMenu::menuAction().
  • Question about plugin environment

    Unsolved
    6
    0 Votes
    6 Posts
    317 Views
    D
    @mpergand said in Question about plugin environment: You can't do that in C++: I found an interesting discussion at SO, which points out, that my code is valid but incomplete. There are (theoretically) 2 options: add using A:riseError; - but that leads to qtcreator crash override both functions in class B meanwhile my project has reached a size where qtcreator crashes quite often. I stil have troubles getting the new project structure built. Following the plugandpaint example my project does not build. Everything gets compiled, but the libraries and plugins are not linked - so lots of unresolved externals. I have to confess, that I don't understand the qmake-hacks in plugandpaint example. I did not find any words in docs. I add the pro-file of one plugin: TEMPLATE = lib CONFIG += plugin static QT += widgets INCLUDEPATH += ../../app HEADERS = basictoolsplugin.h SOURCES = basictoolsplugin.cpp TARGET = $$qtLibraryTarget(pnp_basictools) DESTDIR = ../../plugins qtLibraryTarget is used, but no word about where it is defined. So how could I solve it?
  • 0 Votes
    15 Posts
    9k Views
    M
    Do this for the widgets inside the ToolBox: widget->setBackgroundRole(QPalette::Base);
  • 0 Votes
    2 Posts
    727 Views
    Pl45m4P
    @HowardHarkness Hi there was a similar topic / question few years ago. @SGaist explained why there is one additional space after every mask -> to allow text selection by keyboard. Of course Ctrl + A kinda "hacks" it (to select all, at least) and if you dont need it, you could implement a workaround, but unfortunately there is no "Qt-way" to switch it off. https://forum.qt.io/topic/60633/qlineedit-using-input-mask-with-blank-space-replacement-cursor-select-replacement-char
  • QPushButton SVG stylesheet scaling to max size always, can't resize

    Solved
    6
    0 Votes
    6 Posts
    876 Views
    SGaistS
    It's the QToolButton class that provides this out of the box.
  • How to center a column with a checkbox in QTableView?

    Solved
    18
    0 Votes
    18 Posts
    12k Views
    A.A.SEZENA
    @Alexey-Serebryakov .. I am actively using those codes. With only one difference. QTableWidget instead of QTableView. else if(yapi->slAlan[i] == "ISLEM") { auto * checkWidget = new QWidget(this); auto * check = new QCheckBox(this); auto * checkLayout = new QHBoxLayout(checkWidget); checkLayout->addWidget(check); checkLayout->setAlignment(Qt::AlignCenter); checkLayout->setContentsMargins(0,0,0,0); check->setMaximumWidth(yapi->slColumnWidth[i].toInt()); check->setChecked(q.value(yapi->slAlan[i]).toString() == "2"); check->setCheckable(!bPasif); if(!renk.isEmpty()) { checkWidget->setStyleSheet(tr("background-color: %1").arg(renk)); } tablo->setCellWidget(iSatir, i, checkWidget); checkWidget->setContextMenuPolicy(Qt::CustomContextMenu); connect(checkWidget, &QMenu::customContextMenuRequested, this, &kucukbas::doganPopupMenu); connect(check, &QCheckBox::stateChanged, this, [=]() { doganKaydet("ISLEM", check->isChecked() ? "2" : "0", idDogan()); }); }
  • How to embed text with dynamic images, or gifs and youtube-links?

    Unsolved
    2
    0 Votes
    2 Posts
    157 Views
    sierdzioS
    There is no built-in widget or component for this. Can be implemented, though.
  • Question about QModbusRtuSerialMaster

    Unsolved
    1
    0 Votes
    1 Posts
    127 Views
    No one has replied
  • Centered checkbox in QTableView

    Unsolved
    2
    0 Votes
    2 Posts
    218 Views
    JonBJ
    @Alexey-Serebryakov Well what about starting from @VRonin's https://forum.qt.io/topic/94049/how-to-center-a-column-with-a-checkbox-in-qtableview/8 ?
  • QTableView sunken/bump cells

    Unsolved
    2
    0 Votes
    2 Posts
    206 Views
    SGaistS
    Hi, Sounds rather something for a QStyledItemDelegate so you can control the appearance of the cells the way you want it.
  • Qt6 : readLine() blocking not work

    Unsolved
    2
    0 Votes
    2 Posts
    210 Views
    SGaistS
    Hi and welcome to devnet, You should add the link to the relevant documentation you are mentioning as well as the code you are using to show what the issue might be.
  • Connecting to MariaDB

    Solved
    7
    0 Votes
    7 Posts
    2k Views
    SGSDoomS
    @mrdebug changing to QMysql worked. Thank you for that. Happy Holidays.