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 can grob painter of qwidget that this widget already made ,such as Qtextedit,Qdial,... ?
Forum Updated to NodeBB v4.3 + New Features

[Solved]How can grob painter of qwidget that this widget already made ,such as Qtextedit,Qdial,... ?

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 2.2k 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
    Ali Sarlak
    wrote on last edited by
    #1

    Suppose that you want change background color of Qtextedit or rotate on 45 degree this widget .how do you do it?
    Really i want to know when i have Qwidget that already made how can i make minor change in paintEvent but i don't do rewrite this function.
    I hope I could get what I mean.

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

      For the background color:
      you can change the [[Doc:QPalette]] of the text edit

      For the 45° presentation:
      My first guess would be a [[Doc:QGraphicsScene]] and use a [[Doc:QGraphicsProxyWidget]] containing the text edit.

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

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Ali Sarlak
        wrote on last edited by
        #3

        Thanks Mr.Volker
        @
        //#########################################
        #include <QApplication>
        #include <QGraphicsProxyWidget>
        #include <QTextEdit>
        #include <QGraphicsView>
        #include <QGraphicsScene>

        int main (int argc,char* argv[]){
        QApplication app(argc,argv);

        QTextEdit *te=new QTextEdit(0);
        QGraphicsScene scene;
        
        QGraphicsProxyWidget * container=scene.addWidget(te);
        container->rotate(45);
        
        QGraphicsView view(&scene);
        view.show();
        
        return app.exec(&#41;;
        

        }
        //#########################################
        @
        it's work correctly :D

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

          Glad to see that it worked out!
          You can prepend "[Solved]" to your topic (title), to mark your question as resolved.

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

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

            Excuse me, I'm newbie in qt ,now i have 2 question :
            1-when i use Qt-Creator to design my form how can i use this approach ?
            i drag and drop plugin (QTextEdit,...) how can i add modified widget to my form!
            i can't use QGraphicsView , i think that i just can addwidget(Qwidget) to my Qdialog class and QGraphicsView or QGraphicsProxyWidget not usable for addwidget function.

            2-if i want to more change Qwidget that already made how can i do it?
            for example ,suppose you want to add number on side of notches of QDial or even more suppose you want use special symbol (that you forced draw manually these symbol) on side of notches of QDial.

            thanks for your attention and your time .

            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