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. QtXML: setAttribute(const QString & name, int value): can we set two value ??
Forum Updated to NodeBB v4.3 + New Features

QtXML: setAttribute(const QString & name, int value): can we set two value ??

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 2 Posters 1.5k 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.
  • S Offline
    S Offline
    ShrikantAmbade
    wrote on last edited by
    #1

    Hello,

    setAttribute(const QString & name, int value).. I want to give two value for my attribute
    for example
    <xyz pos="100,200">
    Many Thanks

    the_T 1 Reply Last reply
    0
    • S ShrikantAmbade

      Hello,

      setAttribute(const QString & name, int value).. I want to give two value for my attribute
      for example
      <xyz pos="100,200">
      Many Thanks

      the_T Offline
      the_T Offline
      the_
      wrote on last edited by
      #2

      @ShrikantAmbade

      setAttribute(QString &, int)
      

      is an overloaded method of

      setAttribute(QString &, QString &) 
      

      so

      setAttribute("pos","100,200");
      

      should do what you expect.

      -- No support in PM --

      S 1 Reply Last reply
      0
      • the_T the_

        @ShrikantAmbade

        setAttribute(QString &, int)
        

        is an overloaded method of

        setAttribute(QString &, QString &) 
        

        so

        setAttribute("pos","100,200");
        

        should do what you expect.

        S Offline
        S Offline
        ShrikantAmbade
        wrote on last edited by
        #3

        @the_ yes

        setAttribute("pos","100,200");
        

        but i want to use variable like this

        setAttribute("pos","X,Y");
        

        and x =100, y=200

        but in this case it will print x,y now setAttribute("pos","x,y");

        the_T 1 Reply Last reply
        0
        • S ShrikantAmbade

          @the_ yes

          setAttribute("pos","100,200");
          

          but i want to use variable like this

          setAttribute("pos","X,Y");
          

          and x =100, y=200

          but in this case it will print x,y now setAttribute("pos","x,y");

          the_T Offline
          the_T Offline
          the_
          wrote on last edited by
          #4

          @ShrikantAmbade

          just create a string out of x and y separated by ","

          -- No support in PM --

          S 1 Reply Last reply
          0
          • the_T the_

            @ShrikantAmbade

            just create a string out of x and y separated by ","

            S Offline
            S Offline
            ShrikantAmbade
            wrote on last edited by
            #5

            @the_ but how?

            the_T 1 Reply Last reply
            0
            • S ShrikantAmbade

              @the_ but how?

              the_T Offline
              the_T Offline
              the_
              wrote on last edited by
              #6

              @ShrikantAmbade

              You can find it here :)
              QString Class

              QString str;
              int intval = 10, intval2=20;
              str = QString::number(intval) + "," + QString::number(intval2);
              
              //or
              
              str = str = "%1%2%3";
              str.arg(QString::number(intval),",",QString::number(intval2));
              
              

              -- No support in PM --

              S 1 Reply Last reply
              1
              • the_T the_

                @ShrikantAmbade

                You can find it here :)
                QString Class

                QString str;
                int intval = 10, intval2=20;
                str = QString::number(intval) + "," + QString::number(intval2);
                
                //or
                
                str = str = "%1%2%3";
                str.arg(QString::number(intval),",",QString::number(intval2));
                
                
                S Offline
                S Offline
                ShrikantAmbade
                wrote on last edited by
                #7

                @the_ Many Thanks dear

                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