Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.4k Topics 456.6k Posts
  • Artifacts after moving QGraphicsItem over QWidget

    Unsolved
    8
    0 Votes
    8 Posts
    1k Views
    A
    @SGaist I not move it outside of QGraphicsView. I press at the center of custom QGraphicsObject and move it over the scene, but near the edge of QGraphicsView. The sample version of my files in the attached zip. But in sample I can not replicate the problem. Is it possible that something else affect on it? I use in the application several hearbeats timers with 1s interval and several qthreads…. [0_1541531979038_untitled4.zip](Uploading 100%)
  • Qt Application crashes if it remains idle for some time with attached call stack.

    Unsolved
    3
    0 Votes
    3 Posts
    498 Views
    Pablo J. RoginaP
    @Hetal could you describe the components of your application? is it threaded? are you handling the event loop yourself?
  • 0 Votes
    2 Posts
    893 Views
    R
    By writing a small demo to complete my post, I found the issue. As it might be helpful to somebody else, here it is: demo.scxml: <?xml version="1.0" encoding="UTF-8"?> <scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" binding="early" xmlns:qt="http://www.qt.io/2015/02/scxml-ext" name="plop.scxml" qt:editorversion="4.7.1"> <state id="State_1"> <qt:editorinfo scenegeometry="144.50;162.05;84.50;112.05;120;100" geometry="144.50;162.05;-60;-50;120;100"/> </state> </scxml> demo.py: #!/usr/bin/env python import sys from PySide2.QtCore import QObject, QCoreApplication, SLOT, Slot from PySide2.QtScxml import QScxmlStateMachine class Backend_1(QObject): def __init__(self, machine): super(Backend_1, self).__init__() self.machine = machine self.machine.connectToState("State_1", self, SLOT("s1_active(bool)")) @Slot(bool) def s1_active(self, active): if active: print('Backend_1::State_1: enter') self.submachine = QScxmlStateMachine.fromFile('demo.scxml') b = Backend_2(self.submachine) self.submachine.start() else: print('Backend_1::State_1: exit') class Backend_2(QObject): def __init__(self, machine): super(Backend_2, self).__init__() self.machine = machine self.machine.connectToState("State_1", self, SLOT("s1_active(bool)")) @Slot(bool) def s1_active(self, active): if active: print('Backend_2::State_1: enter') else: print('Backend_2::State_1: exit') if __name__ == '__main__': app = QCoreApplication(sys.argv) machine = QScxmlStateMachine.fromFile('demo.scxml') b = Backend_1(machine) machine.start() sys.exit(app.exec_()) If you run this, you expect to see: Backend_1::State_1: enter Backend_2::State_1: enter But, the second statemachine does not seem to start. To fix it, you need to store the instance of Backend_2 (eg: self.b = Backend_2(self.submachine)). I guess it was garbage collected, so all the states/events connections were broken. Meanwhile, if you think my design patter is bad, I'm willing to learn :)
  • Drawing a clean line by QGraphicsScene

    Solved
    3
    0 Votes
    3 Posts
    494 Views
    M
    @kenchan I'm impressed with your answer. I just add that line and it's working very well. Thank you very much.
  • How to save a treeview after editing it in a .txt file in Qt

    Unsolved
    7
    0 Votes
    7 Posts
    956 Views
    JonBJ
    @Minikornio said in How to save a treeview after editing it in a .txt file in Qt: but it throw me error saying ''call to non-static member function without an object argument" When the compiler gives you such an error, does it not state which line number it occurs on? You need that to locate the error. At a guess: You seem to have changed all of your code to use TreeModel::rowCount() etc. TreeModel is a class/type, hence the warnings. You need an instance to call those methods. Even if you are a beginner, you need to understand the complete difference between classes/types vs instances before you will get very far.
  • beginRemoveRows in QSortFilterProxyModel is not working as expected

    Unsolved
    3
    0 Votes
    3 Posts
    826 Views
    E
    bool k =removeRows(row,1,QModelIndex()); I think this sends the signals. With your own begin... and end... calls you call those signals second time. The state of the model is actually different than what those signals let the view presume.
  • QT threading No such signal QThread::

    Unsolved
    3
    0 Votes
    3 Posts
    1k Views
    S
    Oh thanks a lot. connect(this, SIGNAL(requestUpdate(int)), worker, SLOT(doWork(int)));
  • QMediaRecorder file location

    Unsolved
    3
    0 Votes
    3 Posts
    545 Views
    M
    @jsulm Possibly! But nowhere nothing about this point in qt docs. Probably I'm blind.
  • How to get item after drag item from QListWidget Thumbnails

    Solved
    23
    0 Votes
    23 Posts
    4k Views
    VRoninV
    These are just typos that are easy to fix... c'mon. I just forgot (). index.row should be index.row()
  • Core Dll is missing

    Unsolved
    5
    0 Votes
    5 Posts
    808 Views
    K
    Turns out this was due to a change in the makefile. It was mixing 32 and 64 bit libraries.
  • Reading excel file using QT

    Unsolved
    4
    0 Votes
    4 Posts
    998 Views
    K
    @Pradip-Shinde I am not an expert in that area. I have found just now this Qt wiki To my surprise it uses also ODBC interface. You need to check there
  • How to implement the browse button functionality as show in the image

    Unsolved
    10
    0 Votes
    10 Posts
    3k Views
    D
    Define a custom QDialog, add a QTreeView, set a QFileSystemModel, handle QTreeView selection events to update Directory LineEdit. For the combobox with recent directory selection you need to save history to disk. You could use QSettings to save this list of Directories. Use a QVector <QString> to store the strings because it is easier to prepend strings at top of the list. Populate the recent ComboBox with the saved strings. When you select a directory, make sure it is not in the recent list yet before saving, otherwise just move the existing directory to the first position of the Vector. I thing this is pretty easy to achieve. Do you have a specific question or problem?
  • This topic is deleted!

    Unsolved
    2
    0 Votes
    2 Posts
    120 Views
  • Check state change only when mouse clicks on checkbox

    Unsolved qlistwidget mouse checkstate
    6
    0 Votes
    6 Posts
    4k Views
    A
    @nebulaekg It wasn't wrong, it was just the easy method. With easy comes very little customization. Now that you want to change it's behavior it becomes much harder. For simple lists you can definitely use the widget but for anything more you want a view/model and then delegates to control display. Check into it I'm sure you'll find it's not that much harder than the widget and will give you the control you want. :)
  • QCombobox dropdown list transparent QComboBoxPrivateContainer

    Unsolved
    3
    0 Votes
    3 Posts
    970 Views
    M
    @SGaist Hi, i'm using Qt 5.11.0, Window10 I'll try it your suggestion. Thank you.
  • How to get this icon's name?

    Unsolved
    17
    0 Votes
    17 Posts
    5k Views
    cloud21C
    @Cobra91151 Nice.
  • Dynamic color for a selected QTreeViewItem?

    Solved
    3
    0 Votes
    3 Posts
    2k Views
    mbruelM
    Well I thought I tried... Then I was overriding the whole QPalette with the constructor with 9 QBrush... I've just test your code and it works if I remove any color from the stylesheet on QTreeView:item Thanks a lot! Here is my code: void TreeItemDelegate::initStyleOption(QStyleOptionViewItem *option, const QModelIndex &index) const { QStyledItemDelegate::initStyleOption(option, index); option->textElideMode = Qt::ElideNone; TreeItem *item = static_cast<const TreeModel*>(index.model())->itemFromIndex(index); if (item) { QColor color = item->data(Qt::ForegroundRole).value<QColor>(); option->palette.setColor(QPalette::WindowText, color); option->palette.setColor(QPalette::HighlightedText, color); if (item->isLargeItem()) { option->font.setBold(true); option->decorationSize = QSize(24,24); } if (item->isReadOnly() ) option->font.setItalic(true); } }
  • WASAPI

    Unsolved
    2
    0 Votes
    2 Posts
    366 Views
    SGaistS
    Hi, Looks like there's a backend for it in QtMultimedia. If not what you are looking for, then you should explain what you are trying to do, what is your current status, etc.
  • Creating custom slots and signals

    Unsolved
    14
    0 Votes
    14 Posts
    5k Views
    SGaistS
    From the code you posted, you don't start timer.
  • Widget with Qt::Popup flag ignores KeyPressEvents when MainWindow is minimized

    Unsolved
    2
    0 Votes
    2 Posts
    291 Views
    SGaistS
    Hi, Why are you not calling the base class implementation of keyPressEvent ?