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. IP Address Editor with popup numberpad
QtWS25 Last Chance

IP Address Editor with popup numberpad

Scheduled Pinned Locked Moved Solved General and Desktop
ip addressline editwidgettouch screen
6 Posts 2 Posters 3.9k 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.
  • Sh1gsS Offline
    Sh1gsS Offline
    Sh1gs
    wrote on last edited by
    #1

    I am creating an IP Editor widget by using 4 LineEdits. When you click on a LineEdit, a numberpad pops up for touch interfaces. My question is, how can I make the code general? For example, for single LineEdits, I can have a SIGNAL/SLOT

    connect(lineedit, SIGNAL(sendData(QString), this, SLOT(receiveData(QString));

    and then in my receiveData function it'd look something like:

    void IPEditor::receiveData(const QString &text)
    {
       QLineEdit *mask = qobject_cast<QLineEdit*>(sender());
       if(text)
           mask->setText(text);
    }
    

    How would I go about doing so with 4 LineEdits?

    PS - I will also be accepting keyboard inputs, but I figure I'll figure that part out once I get the touchpad working. Thanks!

    K 1 Reply Last reply
    0
    • Sh1gsS Sh1gs

      I am creating an IP Editor widget by using 4 LineEdits. When you click on a LineEdit, a numberpad pops up for touch interfaces. My question is, how can I make the code general? For example, for single LineEdits, I can have a SIGNAL/SLOT

      connect(lineedit, SIGNAL(sendData(QString), this, SLOT(receiveData(QString));

      and then in my receiveData function it'd look something like:

      void IPEditor::receiveData(const QString &text)
      {
         QLineEdit *mask = qobject_cast<QLineEdit*>(sender());
         if(text)
             mask->setText(text);
      }
      

      How would I go about doing so with 4 LineEdits?

      PS - I will also be accepting keyboard inputs, but I figure I'll figure that part out once I get the touchpad working. Thanks!

      K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      @Sh1gs

      I think you should have a look to QSignalMapper

      However, I am wondering why you are going for four lineedits? A lineedit per three digit part of an ipv4 address?
      If that is your idea, you could do also with an input mask.

      Vote the answer(s) that helped you to solve your issue(s)

      Sh1gsS 2 Replies Last reply
      4
      • K koahnig

        @Sh1gs

        I think you should have a look to QSignalMapper

        However, I am wondering why you are going for four lineedits? A lineedit per three digit part of an ipv4 address?
        If that is your idea, you could do also with an input mask.

        Sh1gsS Offline
        Sh1gsS Offline
        Sh1gs
        wrote on last edited by
        #3

        @koahnig

        I will have to research QSignalMapper to see if that will work for my purpose. I am creating a custom IP Editor plugin for a project at work, which needs to let the user define each input mask individually, hence the 4 lineedits. The input mask doesn't work because of the popup numberpad. I will look into SignalMapper and report back. If anyone else has suggestions, it would be much appreciated.

        1 Reply Last reply
        0
        • K koahnig

          @Sh1gs

          I think you should have a look to QSignalMapper

          However, I am wondering why you are going for four lineedits? A lineedit per three digit part of an ipv4 address?
          If that is your idea, you could do also with an input mask.

          Sh1gsS Offline
          Sh1gsS Offline
          Sh1gs
          wrote on last edited by
          #4

          @koahnig

          I'm still confused about QSignalMapper. I've searched, and it looks like it'd benefit me on the touchscreen numberpad portion, but am unsure how to go about it with the 4 lineedits. There is this example: http://stackoverflow.com/questions/9306335/an-ip-address-widget-for-qt-similar-to-mfcs-ip-address-control. The top voted answer would be perfect if I was just accepting keyboard inputs, but since I'm also doing a touchscreen numberpad, I'm confused as to how to correctly implement it. Does that make sense?

          K 1 Reply Last reply
          0
          • Sh1gsS Sh1gs

            @koahnig

            I'm still confused about QSignalMapper. I've searched, and it looks like it'd benefit me on the touchscreen numberpad portion, but am unsure how to go about it with the 4 lineedits. There is this example: http://stackoverflow.com/questions/9306335/an-ip-address-widget-for-qt-similar-to-mfcs-ip-address-control. The top voted answer would be perfect if I was just accepting keyboard inputs, but since I'm also doing a touchscreen numberpad, I'm confused as to how to correctly implement it. Does that make sense?

            K Offline
            K Offline
            koahnig
            wrote on last edited by
            #5

            @Sh1gs

            I do not understand why you actually require 4 lineedits for one IP address input. The natural assumption is that you are trying to retrieve each field individually. The more natural, but also more complicated way in view of a perfect solution, seems a solution with one lineedit and an input mask.

            There is somewhere in the forum a thread, which presumably I have even started, but can't find anymore. It is a couple of years old and was probably taken over into the new system.
            Anyway there has been a response with an QRegExp validator expression. It works reasonably well, but has some visible flaws. IMHO it would be a better start, but your apporach may be more elegant after you have negotiated around your issues.

            Concerning touchscreen keyboard w/o physical keyboard, I have no experience at all and therefore, I have to bail out.

            Vote the answer(s) that helped you to solve your issue(s)

            1 Reply Last reply
            2
            • Sh1gsS Offline
              Sh1gsS Offline
              Sh1gs
              wrote on last edited by
              #6

              I am going to mark this topic as Solved. I used a lot of the methodologies from this topic. I used 4 lineedits because I'm building a plugin and I want the user to be able to enter each input mask individually.

              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