Solved

setPlainText argument

Posted on 2010-09-13
1
751 Views
Last Modified: 2013-11-23
I have this method witch print that  numbers from loop like that 1,2,3,4,5....etc
I want it to print that AE1,AE2,AE3......etc
how can alter that method i.e in this line text->setPlainText(QString::number(i)); how can I add text I tryed to do that text->setPlainText("AE",QString::number(i)); but i got error
void QtRenderer::electrodes_label(int count_of_electrodes)
{
    for(int i=0 ; i<count_of_electrodes ;i++)
    {
        text = new QGraphicsTextItem(0,scene);
        int x= labelPos_X;
        int y= i*labelPos_Y;
        text->setPos(x,y);
        int num=1;

        text->setPlainText(QString::number(i));
    }

Open in new window

0
Comment
Question by:obad62
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
ID: 33668550
Not that I am absolutely sure about what you want to do, but are you thinking along these lines?
QString lbl = "AE";
QString num = QString::number(i);
QString txt = lbl + num;

text->setPlainText(txt);

Open in new window

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand column That will then direct you to their download page. From that p…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

631 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question