Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.4k Topics 456.4k Posts
  • 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
    159 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
    300 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
    711 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
    859 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
    151 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
    124 Views
    No one has replied
  • Centered checkbox in QTableView

    Unsolved
    2
    0 Votes
    2 Posts
    212 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
    201 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
    204 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.
  • Problem with QTabBar tabs hovering when hover scroller buttons

    Unsolved
    4
    0 Votes
    4 Posts
    543 Views
    H
    I tried to redefine the parent for these buttons of scroller (for the QToolButton's), in this case, there is no overlap on hover, but the width of the buttons do not always turn out to be the same (despite the fact that in css tables they are defined as buttons of the same width).
  • Debug MSVC runtime error (xutility)

    Unsolved
    2
    0 Votes
    2 Posts
    203 Views
    Christian EhrlicherC
    Use a debugger, run your program in there, see where it crashes, take a look into the backtrace and fix your program.
  • QT Bug: Mouse position inaccuracy in macOS Monterey

    Unsolved
    2
    0 Votes
    2 Posts
    196 Views
    Kent-DorfmanK
    you do understand that floating point numbers are approximations, right? Never expect floating point math to represent an exact value. Always compare within a properly scaled tolerance range. isEqual = abs(a-b) < tolerance;
  • showing custom widget inside the mainWindow

    Unsolved
    18
    1 Votes
    18 Posts
    3k Views
    Swati777999S
    @JKSH said in showing custom widget inside the mainWindow: @Swati777999 said in showing custom widget inside the mainWindow: @JKSH said in showing custom widget inside the mainWindow: I believe you have missed @Pl45m4's point. He is asking you to explain: What do you expect this line to do?: QMainWindow *main = new QMainWindow(); Actually, I was trying to write some codes after that [like setting a layout or so]so as to I can add WindowWidget to it, something like that. You should add your WindowWidget to your ScrollAreaApp (which is this in your ScrollAreaApp's constructor). You should not be adding it to some extra QMainWindow. Yes, my other application has code for it and I should be writing this code there while trying but I chose to create another project file for experimenting. Unfortunately, the way that you're carrying out these experiments is making it harder for you to understand the important basics of widget parent-child relationships and layout management. In summary: It is completely wrong to create a new QMainWindow() in your custom widget's constructor. Don't do it, ever... not even for experimenting. This is because the ScrollAreaApp's constructor should only contain things that are placed inside the ScrollAreaApp. (Does this make sense? If not, please ask) I completely understand what you want to convey. So, basically it is preferred to experiment in the same location of the complete application rather than writing a part of code in different project file.
  • QTabWidget, persistent - visible - tab ?

    Unsolved qtabwidget qtabbar
    1
    0 Votes
    1 Posts
    271 Views
    No one has replied