Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.6k Posts
  • how to draw QGraphicsPolygonItem

    Solved
    14
    0 Votes
    14 Posts
    2k Views
    mrjjM
    @hobbyProgrammer Ok. Good. :) It was my only guess how on earth the points list could become empty. Sometimes Im a lucky guesser :)
  • connecting context menu won't work

    Unsolved
    11
    0 Votes
    11 Posts
    888 Views
    jsulmJ
    @hobbyProgrammer said in connecting context menu won't work: void alterRoom(QPolygonF room); it has a parameter which you did not mention in your connect() call. But since the triggered() signal does not provide such a parameter it will not works anyway. Do it with a lambda: QPolyF poly; connect(alterPoly, &QAction::triggered, [poly, this]() { alterPoly(poly); });
  • How to refresh data on horizontal header of QTableWidget?

    Solved
    28
    0 Votes
    28 Posts
    5k Views
    tovaxT
    Solved: Derived from QAbstractTableModel + QTableView Create two QTableView, one for cell's data, another for header data. Frozen the first row of the QTableView used for header data, and refresh data in it (100Hz). (Refer to official demo: Frozen Column Example)
  • how to convert QCharRef to hex, int, binary

    Solved
    14
    0 Votes
    14 Posts
    2k Views
    MijazM
    @J-Hilk Thank you very much. it works
  • How to toggle WindowCloseButton Hint off and on

    Unsolved
    7
    0 Votes
    7 Posts
    1k Views
    A
    @jsulm I am not sure whether I have fully understood your question but the toggle for enabling/disabling the dialog close button is handled and called within the dialog class.
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    1 Views
    No one has replied
  • can i set value at model without using SetModelData()

    Unsolved setmodeldata qstyleditemdele
    4
    0 Votes
    4 Posts
    865 Views
    JonBJ
    @rahi444 I don't claim to understand why you want to do this. However, does the example (teh accepted solution to it) in, say, https://stackoverflow.com/questions/36778577/qstyleditemdelegate-how-to-make-checkbox-button-to-change-its-state-on-click give you what you need? It's using https://doc.qt.io/qt-5/qstyleditemdelegate.html#editorEvent to access the widget's state in an event. Seems a bit low-level to me, but maybe that's what you do....? Otherwise, I know the editor arranges to store the widget's value via editor widget's user property, see https://doc.qt.io/qt-5/qstyleditemdelegate.html#setModelData itself. Can you leverage that without actually calling setModelData()? Finally, https://doc.qt.io/qt-5/qstyleditemdelegate.html#createEditor returns the widget created for doing the editing. Can you put your own slots/call functions on that to recognise when it's edited and retrieve its value directly? If all else fails, what about looking at the source of the setModelData() method you do not want to use in page https://code.woboq.org/qt5/qtbase/src/widgets/itemviews/qstyleditemdelegate.cpp.html ? You can see there what it does (looks pretty simple), and decide what you want to do compared to that, since you don't want to call it yourself for whatever reason.
  • 0 Votes
    2 Posts
    2k Views
    M
    @Threadcore I think there is no limitation. Add to your image output a background color, like this: // Now create the output image QImage output(maxWidth, maxHeight, QImage::Format_RGB32); output.fill(Qt::white); In my case, this is a good solution.
  • This topic is deleted!

    Unsolved
    11
    0 Votes
    11 Posts
    45 Views
  • Remove QGraphicsEllipseItems

    Solved
    7
    0 Votes
    7 Posts
    897 Views
    H
    @mrjj it works! thank you so much. for people watching this: you can change this: QGraphicsEllipseItem*node = qgraphicsitem_cast<QGraphicsEllipseItem*>(item); into this: QGraphicsPolygonItem*node = qgraphicsitem_cast<QGraphicsPolygonItem*>(item); and it will work for a polygon item or into this: QGraphicsPixmapItem*node = qgraphicsitem_cast<QGraphicsPixmapItem*>(item); and it will work for pixmapItems etc. you can change this line into anything to remove all the object that are that type of graphicsItem
  • [SOLVED]QSqlQuery::value: not positioned on a valid record

    6
    0 Votes
    6 Posts
    30k Views
    M
    Hi @bobby, Afer sql.exec(), you have to add sql.next() to get position of database record. Have a nice day.
  • Maintaining aspect ratio of qlabel

    Unsolved
    22
    0 Votes
    22 Posts
    7k Views
    KiraK
    @J-Hilk : Sure
  • Project ERROR: Cannot run compiler 'g++'. Output:

    Unsolved
    18
    0 Votes
    18 Posts
    2k Views
    jsulmJ
    @joseph_ho You should use the command prompt from MinGW installation, then the environment will be setup and ready.
  • cant delete unused properties from ui_ prefixed headers

    Unsolved
    3
    0 Votes
    3 Posts
    219 Views
    jsulmJ
    @U7Development said in cant delete unused properties from ui_ prefixed headers: tryied to edit ui header To make it clear: this file is generated! Each time it is generated your changes will be lost, so do not edit it! Do as @JKSH suggested.
  • QGraphicsView, QGraphicsPath - find closest path ?

    Unsolved qgraphicsview qgraphicspath
    8
    0 Votes
    8 Posts
    685 Views
    D
    Also another problem with path.contains that I find is that the contains would use this as check area > https://doc.qt.io/archives/qt-4.8/images/graphicsview-pathitem.png Which means that the shape can be bigger/inaccurate comparing to the selection location... I think I will need to do some math and create another method for path click intersection. Ok I sorta managed to "fix" it... I ended up creating a forward and then reverse path during selection process. So that the path is a closed - precise - shape. This way I can get proper click detection, I still cant compute which path is closer, but at least selection works properly now.
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    2 Views
    No one has replied
  • add icon on task bar on linux platform

    Solved
    7
    0 Votes
    7 Posts
    980 Views
    C
    @Christian-Ehrlicher MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); setWindowIcon(QIcon(":/image/logo.ico")); ui->tabWidget->setTabPosition(QTabWidget::West); ui->tabWidget->tabBar()->setStyle(new CustomTabStyle); } I did like this, it works. before, I set this in Ui form,that's wrong. Thank you.
  • Nested QGraphicsWidgets in QGraphicsScene

    Unsolved
    4
    0 Votes
    4 Posts
    348 Views
    SGaistS
    I meant only that class to create your board. Why are you using QGraphicsWidget at all ?
  • QNearFieldManager problem

    Unsolved
    1
    0 Votes
    1 Posts
    120 Views
    No one has replied
  • Failing to start a new Qt program on Mac

    Unsolved
    5
    0 Votes
    5 Posts
    409 Views
    SGaistS
    Spaces are rarely a good idea with such a use case.