Skip to content
Qt 6.11 is out! See what's new in the release blog
  • 145k Topics
    725k Posts
    JonBJ
    @rida_zouga You cannot use stylesheet to achieve any difference between individual cells/columns. QTableWidget::item { applies to all items and cannot be "qualified" to apply only to some. Nor is there some setting on a QTableWidgetItem or the underlying setItem(index, value, some-role) to control padding. Padding is just a paint area feature. So, yes, you do need to write a delegate and attach it to your table. Although they seem intimidating initially they are actually very simple once you use them. Here is complete PyQt6 program showing what you are wanting to achieve: import sys from PyQt6.QtWidgets import ( QApplication, QStyledItemDelegate, QStyleOptionViewItem, QTableWidget, QTableWidgetItem) from PyQt6.QtGui import QColor from PyQt6.QtCore import Qt class TableDelegate(QStyledItemDelegate): def paint(self, painter, option, index): option = QStyleOptionViewItem(option) # for all cells/items *other than* those in column 0 # adjust the rectangle to draw/paint in for the padding at each side if index.column() != 0: option.rect.adjust(10, 5, -10, -5) # Visualise the actual non-padded area, just so you can see what the effect is painter.save() painter.fillRect(option.rect, QColor(255, 255, 0, 120)) painter.restore() # allow the cell to be painted, with its rectangle having been potentially changed above super().paint(painter, option, index) if __name__ == "__main__": app = QApplication(sys.argv) tw = QTableWidget(5, 5) for row in range(5): for col in range(5): tw.setItem(row, col, QTableWidgetItem("Hello")) # Create an instance of your delegate class and attach it to the table widget tw.setItemDelegate(TableDelegate()) tw.show() sys.exit(app.exec()) [image: 9a0e161f-aa93-4379-b525-58de3fd38efa.png]
  • Jobs, project showcases, announcements - anything that isn't directly development
    4k 23k
    4k Topics
    23k Posts
    K
    As Qt 6.12 is close to being released (6.12.0 RC was released yesterday!), it's time to continue the Qt Canvas Painter blog series! Qt 6.12 will contain the new Canvas2D aka faster alternative for Quick Canvas. The benchmark in the blog post shows about 40X performance improvement on my laptop, but please test yourself and report findings for example here, as we want to know others' experiences 🙂 Blog post: https://www.qt.io/blog/canvas2d-new-qml-canvas-element-using-qt-canvas-painter Video: https://youtu.be/cXJJDYyDTO0
  • Everything related to designing and design tools

    133 402
    133 Topics
    402 Posts
    A
    Thanks a lot for all this information. It has helped me get clarity on the questions that have been bugging me for weeks. I can now decide better what I want to do, and why. I will definitely share these with them ideas about unifying the UI for mobile and desktop with Qt, as it seems like it doesn't necessarily warrant replacing starting their application from scratch, only their UI code will get replaced (and its bindings).
  • Everything related to the Software Quality Tools

    96 268
    96 Topics
    268 Posts
    C
    @MRosiek said in mouseClick() function does not work when coordinates are passed in: I would love to have function which clicks on desired x and y (without need of object reference). For that you could use: nativeMouseClick() mousePress(x, y, mouseButton) + mouseRelease, etc. These two approaches send the events (mouse move, mouse button down, mouse button up) through the system event queue (or equivalent), which in Squish is often called or considered to be a "native event" (hence the "native" in nativeMouseClick()).
  • Everything related to learning Qt.

    401 2k
    401 Topics
    2k Posts
    Nils SjobergN
    Nice..now he knew whether to perform certification
  • 2k Topics
    13k Posts
    SGaistS
    Please check with the Gerrit admins if that is doable.
  • 4k Topics
    18k Posts
    SGaistS
    Bonjour et bienvenu sur devnet, La formation a l'air plutôt sympathique et la vidéo est très engageante.
  • This is where all the posts related to the Qt web services go. Including severe sillyness.
    1k 10k
    1k Topics
    10k Posts
    M
    I had the same “You are not authorized” error when trying to create a Jira ticket. AlexBlasche’s fix works perfectly, use the direct login URL first