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. QDomNode Swap

QDomNode Swap

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 674 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.
  • S Offline
    S Offline
    shahriar25
    wrote on last edited by
    #1

    Hi
    How can I swap two nodes in a QDomDocument (xml) ?

    Joel BodenmannJ 1 Reply Last reply
    0
    • S shahriar25

      Hi
      How can I swap two nodes in a QDomDocument (xml) ?

      Joel BodenmannJ Offline
      Joel BodenmannJ Offline
      Joel Bodenmann
      wrote on last edited by Joel Bodenmann
      #2

      As QDomDocument doesn't provide a swap() method itself you might just do it the oldschool way (untested):

      QDomDocument a, b;
      
      // Swap QDomDocuments
      {
         QDomDocument tmp(a);
         a = b;
         b = tmp;
      }
      This works because `QDomDocument` implements the `operator=`.
      
      There are also other ways and maybe somebody has a better solution. Maybe you can even use `std::swap`.

      Industrial process automation software: https://simulton.com
      Embedded Graphics & GUI library: https://ugfx.io

      1 Reply Last reply
      0
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #3

        hi
        If you have a pointer to both QDomNode, you can use
        http://doc.qt.io/qt-5/qdomnode.html#replaceChild

        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