Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. How create custom Button that inherits from QPushButton
Forum Updated to NodeBB v4.3 + New Features

How create custom Button that inherits from QPushButton

Scheduled Pinned Locked Moved Mobile and Embedded
5 Posts 4 Posters 7.4k 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.
  • M Offline
    M Offline
    mmesarina
    wrote on last edited by
    #1

    Hi,

    I created a custom Button that inherited from QPushButton because I wanted to customized the look and feel.
    So I implemented the PaintEvent(QPaintEvent *e) method, thinking that this method would be called when I create my custome Button in the code, but in debugging I realized that the PainEvent() method never gets called and what gets displayed when the custom Button is created is just a plain QPushButton with the default look and feel skin.
    So I don't understand than how can one overwrite the default PaintEvent() of the QPushButton.

    Does anyone have an example, some code I can look at?

    thank you

    -Malena

    1 Reply Last reply
    0
    • V Offline
      V Offline
      vinb
      wrote on last edited by
      #2

      mayby you have enough with the "stylesheets":http://doc.qt.nokia.com/latest/stylesheet.html?

      1 Reply Last reply
      0
      • G Offline
        G Offline
        goetz
        wrote on last edited by
        #3

        Did you implement PaintEvent() or paintEvent()? The case of the p does matter!

        http://www.catb.org/~esr/faqs/smart-questions.html

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mmesarina
          wrote on last edited by
          #4

          Thanks guys for the help. Volker you were right, I was using PaintEvent(), I will try to fix this later. And Vinb , yeah, I ended up using the StyleSheet() in the meantime.

          Best

          -malena

          1 Reply Last reply
          0
          • A Offline
            A Offline
            andre
            wrote on last edited by
            #5

            Even with style sheets case does matter. It does everywhere in C++.

            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