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 string and drawtext?
Forum Update on Monday, May 27th 2025

[SOLVED] How to Get string and drawtext?

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 1.5k 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.
  • J Offline
    J Offline
    Jagi
    wrote on 28 Nov 2013, 00:45 last edited by
    #1

    I need your help!
    I'm over 20 hours stucked in my case couse iam a bad programmer :(
    This is my non answerd thread by stackof! Please some one help me!

    http://stackoverflow.com/questions/20243837/qt-get-string-from-c-method-and-drawtext-in-widget

    1 Reply Last reply
    0
    • I Offline
      I Offline
      IamSumit
      wrote on 28 Nov 2013, 06:36 last edited by
      #2

      Hello jagl,

      You can make an object of Output.h class into Widget.h class.
      Using this object You can call add(name,value) function into Widget.cpp.
      But remember add(name,value) must be a public member of output.h class.

      Be Cute

      1 Reply Last reply
      0
      • J Offline
        J Offline
        Jagi
        wrote on 28 Nov 2013, 07:09 last edited by
        #3

        @sumit
        thank you! I understand the strategy but don't know how to write the code!
        this is my Button:
        void Widget::on_pushButton_clicked()
        {
        QPaintEvent e;
        QString name;
        QString value;
        unsigned int name_val= QString::fromStdString(OutPutText::add(name, value));

        painter = paintEvent(e);
        }
        i dont know how to catch the strings from the add(name,value) ant paint them in the widget with my paintevent! it shouldn't be deficult but i dont have ist!!

        1 Reply Last reply
        0
        • I Offline
          I Offline
          IamSumit
          wrote on 28 Nov 2013, 07:40 last edited by
          #4

          ok you need code-I am just writing rough code so you can easily understand.
          In Output.h class

          class Output
          {
          public :
          void add(name,value);
          };
          in Widget.h class

          #include "Output.h"
          class Output;
          class Widget
          {
          private:
          Output *pOutputObj;
          };

          in Constructor of Output class--
          {
          pOutputObj=new Output(this);
          }
          void Widget::on_pushButton_clicked()
          {
          pOutputObj->add(name,value); //here u can call add function
          }
          Remark ::-->Not Tested

          Be Cute

          1 Reply Last reply
          0
          • J Offline
            J Offline
            Jagi
            wrote on 29 Nov 2013, 22:59 last edited by
            #5

            @ semit
            thank you my problem was, i couldn't get the painter word out from my on_pushButton?clicked! but i solved it! and the solution is now on stackoverflow !

            1 Reply Last reply
            0
            • I Offline
              I Offline
              IamSumit
              wrote on 6 Dec 2013, 08:54 last edited by
              #6

              Ok its good...
              Write [SOLVED] before Title, if Your problem is solved.

              Be Cute

              1 Reply Last reply
              0

              1/6

              28 Nov 2013, 00:45

              • Login

              • Login or register to search.
              1 out of 6
              • First post
                1/6
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved