Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.4k Topics 456.4k Posts
  • 0 Votes
    2 Posts
    725 Views
    enjoysmathE
    Re: [Unable to compile with MSVC 2019 - Cannot run cl.exe](but vcvarsall.bat looks all correct) I built SymbolicC++ as a static library but found out its much easier just to INCLUDEPATH a subdirectory made up of all the header files. So I was able to switch back to MinGW kit, which "solves" this for me.
  • QDateEdit Overflows Border

    Unsolved
    4
    0 Votes
    4 Posts
    380 Views
    SGaistS
    If you can reproduce it with a minimal example, then it's likely a bug. Note that you might want to check the latest beta of 6.1 to seen if there part has improved.
  • Including files

    Unsolved
    15
    0 Votes
    15 Posts
    967 Views
    SGaistS
    Because using sleep to ensure your process is done is not the right way to ensure it has run and that it happened without error.
  • [SOLVED]QFileSystemModel set root path

    20
    0 Votes
    20 Posts
    14k Views
    terma.abaT
    What if the view is QML ListView and has no setRootIndex()? QFileSystemModel is badly designed, it makes wrong assumptions on functions you have to be able to call on the view.
  • Update All Controls every 200ms

    Solved
    10
    0 Votes
    10 Posts
    654 Views
    SGaistS
    You're welcome ! Out of curiosity, why do you need to send the checkbox status every 200ms ?
  • QMenuBar does not show action checkbox

    Unsolved qmenubar qcheckbox qaction
    4
    0 Votes
    4 Posts
    853 Views
    SGaistS
    If this is reproducible with C++, then C++ since the Python bindings are built on top of it.
  • Qt Linguist generate senseless files in project folder on MacOS. Why?

    Unsolved
    2
    0 Votes
    2 Posts
    138 Views
    SGaistS
    Hi, Which version of Qt ? On which version of macOS ? How are you using Linguist ? How does your .pro file look like ?
  • Qt Gradient stylesheet not applying

    9
    0 Votes
    9 Posts
    15k Views
    L
    Thanks @vezprog, it worked very fine.
  • Linguist ignoring qStr. Why?

    Solved
    9
    0 Votes
    9 Posts
    912 Views
    B
    @sierdzio Thx
  • Qt 3D Qt3DExtras::Qt3DWindow::show() is slow.

    Unsolved qt3d qt3d scene3d
    1
    0 Votes
    1 Posts
    472 Views
    No one has replied
  • [Q3D] Setting aspect ration has no effect on an image

    Solved
    5
    0 Votes
    5 Posts
    338 Views
    V
    I jus try to anderstand the logic behide the way the pojection matrix is being formed in Qt3D. It's really poor documented and the code surfing is time consuming. For the moment I've solve my issue. Not quite elegantly but yet.... What I was trying to do back then is assigning the projection matrix myself to fit the properties of my camera. Eventually I did it but it has taken my dayoff to dig the code. When it comes to Framegraph it even worse.... Anyway anything NOT out of box is an automatic sentence to mining the code up to the end of your life your project life. It starts getting on my nerves. Only QML examples gives some explanation to the way things has to be done. Yet the QL and C++ versions are far from being isomorphic since QML is basically a configurator for C++ classes with thousands of wrappers to make it work. I've made the code above worked bt the problem is I don't know how yet. So the essue can be marked solve unfortunatly without a benifit to anyone
  • hasFocus() ??

    Unsolved
    6
    0 Votes
    6 Posts
    841 Views
    mrjjM
    Hi Useing code to check for fucus will work poorly if used in constructor and code must be run every time focus shifts so it's easier to do with stylesheet alone. QLineEdit:focus { color:red; } [image: drop4.gif]
  • QFileDialog::getOpenFileName with file name line edit?

    Solved
    2
    0 Votes
    2 Posts
    374 Views
    Christian EhrlicherC
    @Joachim-W said in QFileDialog::getOpenFileName with file name line edit?: at least not in native mode under Debian So why do you ask here when you use debian with a native gtk file dialog?
  • Btchat example doesn’t work correctly on Ubuntu 20.04

    Unsolved
    1
    0 Votes
    1 Posts
    438 Views
    No one has replied
  • how to use JSON from QJsonValue ?

    Solved
    6
    0 Votes
    6 Posts
    2k Views
    Xena_oX
    @JonB thank you @Alvein thank you , your example is great, i could figure out how to read the data response. so far its like guessing whats inside the data packet. thanks a lot :-)
  • 0 Votes
    3 Posts
    703 Views
    V
    hi there, JulianM Could you explain a little bitmore, how the vertex count affect the picking? and what was the problem exactly(how it was solved)?
  • How to change the border color of each cell without changing background color!

    Unsolved
    2
    0 Votes
    2 Posts
    174 Views
    No one has replied
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    15 Views
    No one has replied
  • Add an always visible spinbox colum in QtableView

    Unsolved
    2
    0 Votes
    2 Posts
    590 Views
    N
    I finally achieved to a good little result: [image: eaID3P9.png] I have some questions remaining: For the moment, the editor shows when double clicking anywhere on the column 2. I would like to show the editor only if the user clicked on the number on the center, and not on the arrows on the side. For that, I would need to retrieve the mouse position when entering the function createEditor, but I don't know how to do. I guess that I can re-implement in some way the function that makes the editor popping... Also, is my code ugly in term of conception ? What can I improve to make it prettier then ? from PySide2 import QtCore, QtWidgets, QtGui from model_ui.segment_model import Columns class SpinBoxDelegate(QtWidgets.QStyledItemDelegate): """This delegates allow a custom display of a spinbox into a tableview""" def __init__(self, parent): super().__init__(parent) def is_segment_analyzed(self, index): """Checks from a given SegmentModel index, if the corresponding segment have been analyzed """ analyzed_index = index.siblingAtColumn(Columns.analyzing.value) return not index.model().get_attribute_from_index(analyzed_index) def createEditor(self, parent, option, index): """Returns a new SpinBox widget if the segment have been analyzed""" if self.is_segment_analyzed(index): return QtWidgets.QSpinBox(parent) return None def setEditorData(self, editor, index): """Handles the way editor store new data""" editor.setValue(int(index.data())) def editorEvent(self, event, model, option, index): """This function is used to handle the interactions with handmade buttons. """ # If the event is a click event if event.type() == QtCore.QEvent.MouseButtonRelease: # Retrieves the button positions left_arrow_button, right_arrow_button = self.get_left_right_arrow_buttons(option) # Retrieves the combo index value from the model index current_combo_value = int(index.data()) value_changed = False # If left button was clicked, we decrease combo index if left_arrow_button.contains(event.pos()): if current_combo_value > 0: value_changed = True current_combo_value = current_combo_value - 1 # If left button was clicked, we increase combo index if right_arrow_button.contains(event.pos()): # TODO: Globally handle right combo limit (for all the project) value_changed = True current_combo_value = current_combo_value + 1 # Report the changes to the model if value_changed: model.setData(index, current_combo_value) def updateEditorGeometry(self, editor, option, index): editor.setGeometry(option.rect) def get_left_arrow_button(self, option): """Creates the left arrow button, depending on the option rect area""" arrow_buttons_size = option.rect.height()//1.5 left_arrow_box = QtCore.QRect( option.rect.left()+1, option.rect.top()+(option.rect.height()//4.5), arrow_buttons_size, arrow_buttons_size) return left_arrow_box def paint_left_arrow_button(self, painter, option): """Creates the left arrow button et paints it""" left_arrow_box = self.get_left_arrow_button(option) painter.drawRect(left_arrow_box) painter.fillRect(left_arrow_box, QtGui.QColor(255, 255, 255)) painter.drawText(left_arrow_box, QtCore.Qt.AlignCenter, "<") def get_right_arrow_button(self, option): """Creates the right arrow button, depending on the option rect area""" arrow_buttons_size = option.rect.height()//1.5 right_arrow_box = QtCore.QRect( option.rect.right()-arrow_buttons_size, option.rect.top()+(option.rect.height()//4.5), arrow_buttons_size, arrow_buttons_size) return right_arrow_box def paint_right_arrow_button(self, painter, option): """Creates the right arrow button et paints it""" right_arrow_box = self.get_right_arrow_button(option) painter.drawRect(right_arrow_box) painter.fillRect(right_arrow_box, QtGui.QColor(255, 255, 255)) painter.drawText(right_arrow_box, QtCore.Qt.AlignCenter, ">") def get_left_right_arrow_buttons(self, option): return self.get_left_arrow_button(option), self.get_right_arrow_button(option) def paint_left_right_arrow_buttons(self, painter, option): self.paint_left_arrow_button(painter, option) self.paint_right_arrow_button(painter, option) def paint(self, painter, option, index): painter.save() if not self.is_segment_analyzed(index): painter.setPen(QtGui.QPen(QtGui.QColor(255, 255, 255))) painter.drawRect(option.rect) painter.restore() return option_spinbox = QtWidgets.QStyleOptionSpinBox() option_spinbox.rect = option.rect option_spinbox.state = option.state # By default: white pen (eraser) painter.setPen(QtGui.QPen(QtGui.QColor(255, 255, 255))) # If the segment have been analyzed: we draw information # Else, we proint a blank cell if self.is_segment_analyzed(index): painter.setPen(QtGui.QPen(QtGui.QColor(0, 0, 0))) painter.drawText(option_spinbox.rect, QtCore.Qt.AlignCenter, str(index.data())) self.paint_left_right_arrow_buttons(painter, option_spinbox) painter.setPen(QtGui.QPen(QtGui.QColor(255, 255, 255))) # If the segment associated to the spinbox is selected: green line if option_spinbox.state & QtWidgets.QStyle.State_Selected: painter.setPen(QtGui.QPen(QtGui.QColor(0, 255, 0))) # Drawing boundaries painter.drawRect(option_spinbox.rect) painter.restore() def sizeHint(self, option, index): """Gives an hint about the minimal size of the element to the view""" number_of_digits_to_draw = len(str(index.data())) arrow_button_width = 25 width = number_of_digits_to_draw * 10 + 2 * arrow_button_width height = 45 return QtCore.QSize(width, height)
  • What is happening with forum post entry screen?

    Unsolved
    12
    0 Votes
    12 Posts
    858 Views
    Chris KawaC
    I do object to the sermons. It is getting tiresome. Likewise, lecturing others like that is no fun. I would rather not :/ You can all object to my style , but it is no business of yours. It is, as your style directly impacts us and others. You are not living in vacuum.