Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Game Development
  4. I want to highlight the grid layout view port after click?
Forum Updated to NodeBB v4.3 + New Features

I want to highlight the grid layout view port after click?

Scheduled Pinned Locked Moved Unsolved Game Development
10 Posts 2 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.
  • A Offline
    A Offline
    amarism
    wrote on last edited by
    #1

    I have a grid layout and inside i distribute the layout in four section. So, I want to highlight the port by clicking on the viewport.
    This is my grid layout image view :

    0_1533797156617_viewport.jpg

    Once I clicked on viewport it will be highlighted.

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

      Hi,

      What are these sections ?

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

      A 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        What are these sections ?

        A Offline
        A Offline
        amarism
        wrote on last edited by
        #3

        @SGaist suppose this one is a widget. I want to highlight the widget after clicking

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

          What about QRubberBand ?

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

          A 1 Reply Last reply
          1
          • SGaistS SGaist

            What about QRubberBand ?

            A Offline
            A Offline
            amarism
            wrote on last edited by
            #5

            @SGaist This one not working for me

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

              Well... With that much information, it sure is easy to help you.

              You might want to consider explaining what you tried, what you got, etc.

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

              A 2 Replies Last reply
              0
              • SGaistS SGaist

                Well... With that much information, it sure is easy to help you.

                You might want to consider explaining what you tried, what you got, etc.

                A Offline
                A Offline
                amarism
                wrote on last edited by amarism
                #7

                @SGaist I used this one code for highlighting. I do not understand, why we r taking "origin". In this link http://doc.qt.io/qt-5/qrubberband.html

                void mainwindow::mousePressEvent(QMouseEvent *event)
                {
                //origin = event->pos();
                if (!this->ui->view1)
                return;
                this->ui->view1->setGeometry(QRect(event->pos(), QSize()));
                this->ui->view1->show();
                }

                void mainwindow::mouseMoveEvent(QMouseEvent *event)
                {
                this->ui->view1->setGeometry(QRect(event->pos(), event->pos()).normalized());
                }

                void mainwindow::mouseReleaseEvent(QMouseEvent *event)
                {
                this->ui->view1->hide();
                }

                1 Reply Last reply
                0
                • SGaistS SGaist

                  Well... With that much information, it sure is easy to help you.

                  You might want to consider explaining what you tried, what you got, etc.

                  A Offline
                  A Offline
                  amarism
                  wrote on last edited by
                  #8

                  @SGaist
                  Can I create a border around it? So, it will show highlighted after clicking.

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

                    In your case, you don't build the rectangle using mouse move, hence you can ignore that part. A border around what ?

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

                    A 1 Reply Last reply
                    0
                    • SGaistS SGaist

                      In your case, you don't build the rectangle using mouse move, hence you can ignore that part. A border around what ?

                      A Offline
                      A Offline
                      amarism
                      wrote on last edited by amarism
                      #10

                      @SGaist Border around the widget after mouse clicking?

                      After removing the mouse move code my output comes like this and when i will press after the widget 1. it will change to normal form.

                      0_1534400447879_dsrkjgb.jpg

                      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