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. Generate hover/Pressed/Released on Painter
Forum Updated to NodeBB v4.3 + New Features

Generate hover/Pressed/Released on Painter

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

    Hi all,

    I have post one Issue that is resolved regarding Adding " || " on top scrollBar in left and right most that was done using QPainter.

    void paintEvent(QPaintEvent* event)
    	{
    		QScrollBar::paintEvent(event);
    
    		QPainter p(this);
    		QStyleOptionSlider opt;
    		initStyleOption(&opt);
    		opt.subControls = QStyle::SC_All;
    
    		QRect handleRect = this->style()->subControlRect(QStyle::CC_ScrollBar, &opt, QStyle::SC_ScrollBarSlider, this);
    		p.drawText(handleRect, Qt::AlignLeft,"  ||");
    		p.drawText(handleRect, Qt::AlignRight,"||  ");
    		p.drawRect(handleRect);
    }
    

    http://i.stack.imgur.com/Acg62.png --> This is the reference Image you can see on Top Scroll I am able to create " || " on both end .

    Now the requirement is to generate & catch hover/pressed/released event's on leftmost as well rightmost on top of the line Drawn.

    So need a suggestion Thanks for your support !!!!

    Thanks
    Praveen

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      AFAIK, you can do it using the corresponding mousePress/mouseRelease method but you'll have to the math yourself to determine if your mouse is over the regions of interest.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      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