Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Language Bindings
  4. QPainter: Assemble parts of a widget.
Forum Updated to NodeBB v4.3 + New Features

QPainter: Assemble parts of a widget.

Scheduled Pinned Locked Moved Language Bindings
1 Posts 1 Posters 2.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Raschko
    wrote on last edited by
    #1

    I've been looking into owner draw painting, using QPainter.

    My basic understanding runs as far as in "this tutorial here.":http://blog.rburchell.com/2010/02/pyside-tutorial-custom-widget-painting.html

    Along with the regular class references.

    The task being, creating a custom widget that uses bits of another one.

    Currently my goal is to draw a widget using the background theme represented inside a table view header.

    This corresponds with my previous post, editing a tableviews header labels.

    I've seen notes using a QStylepainter, but no tutorials for that particular option.

    Any ideas/examples are appreciated, thank you. :)

    @

    --: Import the required modules:

    from PySide.QtGui import * # QT widget library

    class Key(QWidget):

    --------------

    On creation do

    --------------

    def init(self, parent):

    Init the parent constructor:

    QWidget.init(self, parent)

    --------------------------------------

    When the widget requires a repaint do:

    --------------------------------------

    def paintEvent(self, ev):

    this = QPainter( self)

    ..

    if name == 'main':
    import sys; app = QApplication(sys.argv)
    window = QWidget(None)
    widget = Key(window)
    window.show()
    app.exec_()
    @

    Shop smart, shop "S"mart!

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved