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. Highlight the area
QtWS25 Last Chance

Highlight the area

Scheduled Pinned Locked Moved General and Desktop
13 Posts 4 Posters 3.2k Views
  • 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
    mythili
    wrote on last edited by
    #1

    Hi, I am using scribble example and i am trying to highlight the area on mouseMoveEvent. Please help me

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tobias.hunger
      wrote on last edited by
      #2

      Providing more information might increase your chance to get answers... Which OS are you targeting? What exactly are you trying to do? What have you tried so far and how did the results fall short of your expectations?

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mythili
        wrote on last edited by
        #3

        I am using UBUNTU 12.04 and my Qt version is 5.0.

        I have taken the scribble example. In scribble area, after writing the text or drawing something, i want to highlight some area i.e., i will move the mouse on the text which i want to highlight.

        I am trying to read the point and setPen over that point..but its not working properly.

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

          DO you mean "this one":http://harmattan-dev.nokia.com/docs/library/html/qt4/widgets-scribble.html?
          Nevertheless i don't believe that there is any simple solution to what you want to do. There are too much open question how the solution should behave in various cases to find the best solution in first place.

          --- 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
          • M Offline
            M Offline
            mythili
            wrote on last edited by
            #5

            Please find the attached link.

            "like this":http://www.google.co.in/search?hl=en&site=imghp&tbm=isch&source=hp&biw=1301&bih=678&q=highlight+the+text&oq=highlight+the+text&gs_l=img.3...2217.7887.0.8111.20.6.1.13.14.0.116.559.5j1.6.0...0.0...1ac.1.9.img.KjnP2iqQCkA#imgrc=q10lwTd9IFKYsM:;MHk4HhZOTWBSSM;http%3A%2F%2F1.bp.blogspot.com%2F_Rf56AL-pm3Y%2FTOzl2m20HXI%2FAAAAAAAAH-E%2Ff3UkgfZ5eTY%2Fs1600%2Fhighlight-text-adobe-reader-3.png;http%3A%2F%2Fwww.spotht.com%2F2010%2F11%2Fhighlightunhighlight-text-in-adobe.html;764;391

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

              [quote author="mythili" date="1366717290"]Please find the attached link.

              "like this":http://www.google.co.in/search?hl=en&site=imghp&tbm=isch&source=hp&biw=1301&bih=678&q=highlight+the+text&oq=highlight+the+text&gs_l=img.3...2217.7887.0.8111.20.6.1.13.14.0.116.559.5j1.6.0...0.0...1ac.1.9.img.KjnP2iqQCkA#imgrc=q10lwTd9IFKYsM:;MHk4HhZOTWBSSM;http://1.bp.blogspot.com/_Rf56AL-pm3Y/TOzl2m20HXI/AAAAAAAAH-E/f3UkgfZ5eTY/s1600/highlight-text-adobe-reader-3.png;http://www.spotht.com/2010/11/highlightunhighlight-text-in-adobe.html;764;391[/quote]

              and whats your underlying "base" widget now?

              --- 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
              • C Offline
                C Offline
                Code_ReaQtor
                wrote on last edited by
                #7

                I never tried to get into the Scribble's source code but I tried to implement this problem months ago.

                Get the initial point via mousePressEvent and the other point via mouseReleaseEvent. Take note that there might be an offset in the resulting points since point(0,0) is on the top-left of the widget/window, so subtract if needed (e.g. margin is present). Get a QRect using the 2 points you obtained and implement your goal (e.g. cropping, drawing a rectangle on that region, etc.)

                Please visit my open-source projects at https://github.com/Code-ReaQtor.

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  mythili
                  wrote on last edited by
                  #8

                  raven-worx

                       My underlying base widget is QScrollArea.
                  

                  Code_ReaQtor : Robot Herder

                      1) How to draw a dotted line rectangle.
                      2) How to highlight the area under the text.
                  
                  1 Reply Last reply
                  0
                  • C Offline
                    C Offline
                    Code_ReaQtor
                    wrote on last edited by
                    #9

                    [quote author="mythili" date="1366776687"]
                    Code_ReaQtor : Robot Herder

                        1) How to draw a dotted line rectangle.
                        2) How to highlight the area under the text.
                    

                    [/quote]

                    1. If you are going to use QPainter, just specify the PenStyle using QPainter::setPen()
                    2. Sorry, I can't help you with that. :( I never tried to implement that.

                    Please visit my open-source projects at https://github.com/Code-ReaQtor.

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

                      [quote author="mythili" date="1366776687"]
                      My underlying base widget is QScrollArea.
                      [/quote]

                      whats inside your scrollarea...or to make it clear: what widget holds your text?

                      --- 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
                      • M Offline
                        M Offline
                        mythili
                        wrote on last edited by
                        #11

                        I am having QWidget inside scrollarea.. I am writing in that area. After writing, i want to highlight some area with yellow color.

                        I am retrieving the start point and end point. Drawing a QRect . How to fill that area under the text.

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

                          so you have a basic QWidget (inside the scroll area) and do the painting of the text yourself?

                          --- 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
                          • M Offline
                            M Offline
                            mythili
                            wrote on last edited by
                            #13

                            I am painitng in that area. But i will select an area over the painted area, so that , the region should be highlighted with different color under the painted part.

                            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