Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] How to get QToolTip mask?
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] How to get QToolTip mask?

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.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.
  • R Offline
    R Offline
    rom8726
    wrote on last edited by
    #1

    Hi! I want to create my control based on QLabel, and I want to set label's shape like platform-dependent tooltip's shape... So, I need to get QToolTip mask and apply it for label.
    I tried:
    [code]
    QLabel label;
    QStyleHintReturnMask mask;
    QStyleOption opt;
    opt.initFrom( &label );
    QApplication::style()->styleHint( QStyle::SH_ToolTip_Mask, &opt, &label, &mask );
    [/code]
    but mask.region.isEmpty() returns true...

    1 Reply Last reply
    0
    • raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      do you want to make your custom widget look like a tool tip?
      I'm not sure what exactly the mask should return and if it is used for all platforms at all.
      If you just want to make it look like use QLabel, it's sizeHint() method and do this in the paint method (taken from QTipLabel class - used by QToolTip):
      @
      void QTipLabel::paintEvent(QPaintEvent *ev)
      {
      QStylePainter p(this);
      QStyleOptionFrame opt;
      opt.init(this);
      p.drawPrimitive(QStyle::PE_PanelTipLabel, opt);
      p.end();

      QLabel::paintEvent(ev);
      

      }
      @

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      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