Results 1 to 5 of 5

Thread: input widget for vectors (e.g. double v[6]) - howto do?

  1. #1

    Default input widget for vectors (e.g. double v[6]) - howto do?

    Hi,

    in my program I have to maintain 4 vectors of length 8. The length might vary a little in future.

    I don't want to add every vector component manually to the UI. So my question is if there is an easy way to create an own input widget for this?

    rgds
    kk

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: input widget for vectors (e.g. double v[6]) - howto do?

    You can create your own custom widget composed from spinboxes or whatever else you want and add instances of that widget to your form either though widget promotion or a custom widget plugin for Designer.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jun 2010
    Posts
    31
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: input widget for vectors (e.g. double v[6]) - howto do?

    kk,

    Could you give us a little bit more insight into what you're trying to accomplish? Are you asking if there's a widget that can act as a button to add vectors to your UI, to modify the length of the widgets, or something else entirely. Right now the only answer I can give you to your questions is "yes, probably" without getting a better idea of what you're trying to do.

    Cheers,
    sp

  4. #4

    Default Re: input widget for vectors (e.g. double v[6]) - howto do?

    Hi SP,

    >Are you asking if there's a widget that can act as a button to add vectors to your UI
    That doesn't sound like my idea.

    I want to create a UI for an algorithm which needs 4 double[8] vectors [or call it array] as input parameters. I hope there's any easy way that I only have one mainWidget per vector which maybe looks like 8 lineedits (subWidgets) side by side. On the UI I would only add the mainWidgets and set the width and number of subewidgets (vector length). Maybe that's not too complicated, but I just started with QT and I always had my issues with UI programming.

    I hope I could clarifiy it a little.

  5. #5
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: input widget for vectors (e.g. double v[6]) - howto do?

    It is hard for us to respond to your question, because you can use a lot of methods to achieve that (and might depend on other stuff, like: how/where you store your vector, etc)

    You can use:
    1) spinbox (QDoubleSpinBox most likely because you want double), here you can choose a widget with: one label, one spinbox, and one submit button (and of-course an algorithm to repeat the actions for each element)
    2) a spinbox for each element
    3) a line edit for each vector (with double values separated by comma, or space or what you like)
    4) a textedit (you can use new-line for vector delimitation, and comma or space for values)
    5) derive a class from QTableWidget (and make an excel-like program), if you need more computation on the values
    ... i'm sure that there are a lot more ways to achieve this, imagination is the limit

    Think as you are the user... so i ask you: How would you like to enter the input in this application?

Similar Threads

  1. Replies: 0
    Last Post: 28th April 2010, 11:41
  2. Animated graphical widget in systray. howto?
    By Tetractys in forum Newbie
    Replies: 2
    Last Post: 6th October 2009, 23:51
  3. Ip address input widget
    By jjbabu in forum Qt Tools
    Replies: 1
    Last Post: 28th September 2008, 20:36
  4. Replies: 1
    Last Post: 17th July 2008, 14:42
  5. regarding input widget
    By jagadish in forum Qt Tools
    Replies: 1
    Last Post: 28th June 2007, 12:07

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.