Results 1 to 8 of 8

Thread: How to connect the ARROWS from QDoubleSpinBox to display the next ARRAYINDEX?

  1. #1
    Join Date
    May 2009
    Location
    Vienna
    Posts
    91
    Thanks
    18
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question How to connect the ARROWS from QDoubleSpinBox to display the next ARRAYINDEX?

    Hi!

    In QDoubleSpinBox the Arrows or singlestep() does change only the displayed value, but it doesn't select the next Entry in the Array!?!

    How can i connect the up/down-Arrows to the Arrayindex? e.g. MyData[20] ...MyData[21]


    greetings Astronomy

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How to connect the ARROWS from QDoubleSpinBox to display the next ARRAYINDEX?

    You will have to look in to the QDoubleSpinBox class code and see if the member is private or protected.
    If it is only protected you can subclass and access it in your subclass.
    If it is private, bad luck.
    You can copy the code and re implement your own QDoubleSpinBox.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. The following user says thank you to high_flyer for this useful post:

    Astronomy (15th January 2010)

  4. #3
    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: How to connect the ARROWS from QDoubleSpinBox to display the next ARRAYINDEX?

    Are you looking for something like QwwTextSpinBox?
    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.


  5. #4
    Join Date
    May 2009
    Location
    Vienna
    Posts
    91
    Thanks
    18
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to connect the ARROWS from QDoubleSpinBox to display the next ARRAYINDEX?

    Hi,
    thanks but QwtTextSpinBox is not the thing i need. (-:

    OK i see i have to make user defined Widgets. The members of QDoublespinbox, ( singlestep(), setsinglestep() ) are public. The new Class QMyDoublespinbox i have to promote in a new class in the QtDesigner in mainwindow_ui.
    like:
    http://books.google.at/books?id=T373...0class&f=false

    Hmmm...
    it turns out that i should have done this much earlier. Until now my Program is working fine with several Arrays from my own type: CMyData. I could put these CMyData -.Arrays as members in the mentioned new class: QMyDoublespinbox, but this will be a major rework. Because the Data should be only stored at one place in the SW. (At the Arrays or the customized Widgets) And i don't think a rework a this point will be wise (-;

    i'll keep u updated
    greetings, Astronomy
    Last edited by Astronomy; 2nd February 2010 at 15:58.

  6. #5
    Join Date
    May 2009
    Location
    Vienna
    Posts
    91
    Thanks
    18
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to connect the ARROWS from QDoubleSpinBox to display the next ARRAYINDEX?

    Hahahahaha
    OK, after several Linker Errors: related to Q_OBJECT: " undefined reference to `vtable for.... ", i do the subclass thing another time (:= if i have more time for this topic *gg* ).

    The best alternative solution is:
    1) disable the Arrows from QDoubleSpinBox (with ButtonSymbols in QtDesigner...)
    2) implement 2 toolButton's like
    ui->toolButtonWavelengthUp->setArrowType(Qt::UpArrow);
    ui->toolButtonWavelengthDown->setArrowType(Qt:ownArrow);
    2a) customize the size...
    3) and let the Buttons navigate through the Arrays, and the QDoubleSpinBox does only the visualisation part.

    Well this is a pity, i can remember, in Microsoft Visual Foundation Classes MFC 6.0, those Widgets were already implemented about ~ 1996 (-;
    greetings Astronomy
    Last edited by Astronomy; 2nd February 2010 at 16:17.

  7. #6
    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: How to connect the ARROWS from QDoubleSpinBox to display the next ARRAYINDEX?

    What exactly are you trying to implement? It really seems you are overcomplicating the problem.
    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.


  8. #7
    Join Date
    May 2009
    Location
    Vienna
    Posts
    91
    Thanks
    18
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to connect the ARROWS from QDoubleSpinBox to display the next ARRAYINDEX?

    Hi, i'm looking basicly for something like: QDoubleSpinBoxArray, QDoubleSpinBoxList,.., or

    Qt Code:
    1. CListView WidgetView; // (i have this in my far memory..)
    2. WidgetView.AddItem( double ) // add some variable with the correct type.....
    To copy to clipboard, switch view to plain text mode 

    In my SW, i wish to add in a loop for example:

    Qt Code:
    1. for(int i =0; i < MyArray.Size(); i++)
    2. {
    3. WidgetView.AddItem( MyArray[i]; )
    4. }
    To copy to clipboard, switch view to plain text mode 

    And then i want to navigate with the Arrows of the widget through the index, and not through the digits/numbers of "2340.22", for example.
    It would be nice to have such a feature. Maybe i did not have found the correct or appropriate widget until now, or i have overseen the correct member function of
    http://doc.trolltech.com/4.5/qdouble...x-members.html

    The Problem is:
    QDoubleSpinBox has no item like
    Qt Code:
    1. QVector <double> Data
    To copy to clipboard, switch view to plain text mode 
    I tried that subclass thing, but, i run into too much troubles. (of course i have to learn it someday..)

    For the interested reader i did:
    header file:

    Qt Code:
    1. #ifndef CMYDOUBLESPINBOX_H
    2. #define CMYDOUBLESPINBOX_H
    3.  
    4.  
    5. #include <qspinbox.h>
    6. #include <CData.h>
    7.  
    8. class CMyDoubleSpinBox : public QDoubleSpinBox
    9. {
    10. Q_OBJECT
    11.  
    12. public:
    13. CMyDoubleSpinBox(QWidget *parent = 0);
    14.  
    15. double singleStep() const;
    16. void setSingleStep(double value);
    17.  
    18. CData MyData;
    19.  
    20. };
    21.  
    22. #endif // CMYDOUBLESPINBOX_H
    To copy to clipboard, switch view to plain text mode 
    and the cpp file: The out commented things are from the original implementation.
    Qt Code:
    1. #include "CMyDoubleSpinBox.h"
    2.  
    3.  
    4. CMyDoubleSpinBox::CMyDoubleSpinBox(QWidget *parent ): QDoubleSpinBox(parent)
    5. {
    6. ;
    7. }
    8.  
    9.  
    10.  
    11. double CMyDoubleSpinBox::singleStep() const
    12. {
    13. // Q_D(const QDoubleSpinBox);
    14.  
    15. // return d->singleStep.toDouble();
    16. }
    17.  
    18. void CMyDoubleSpinBox::setSingleStep(double value)
    19. {
    20. // Q_D(QDoubleSpinBox);
    21.  
    22. // if (value >= 0)
    23. // {
    24. // d->singleStep = value;
    25. // d->updateEdit();
    26. // }
    27.  
    28.  
    29. }
    To copy to clipboard, switch view to plain text mode 


    regards Astronomy
    Ah! and sorry for any grammatical mistakes in my English,
    maybe because of that, something does not come out clear
    Last edited by Astronomy; 3rd February 2010 at 14:12. Reason: grammatic...

  9. #8
    Join Date
    May 2009
    Location
    Vienna
    Posts
    91
    Thanks
    18
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to connect the ARROWS from QDoubleSpinBox to display the next ARRAYINDEX?

    OK, The "Promote to CMyDoubleSpinBox" - Thing is now compiling and linking. Maybe a "rebuild all", did solve the linker errors? Well if i find the correct signals and slots it may be working with sub-classing CDoubleSpinBox

    regards A.
    Last edited by Astronomy; 3rd February 2010 at 14:13.

Similar Threads

  1. how to customize arrows of QScrollBar ??
    By kunalnandi in forum Qt Programming
    Replies: 0
    Last Post: 24th March 2009, 05:05
  2. Docking Arrows
    By asriniva in forum Qt Programming
    Replies: 1
    Last Post: 24th March 2009, 00:08
  3. auto-repeating arrows
    By skrzypu in forum Qt Programming
    Replies: 0
    Last Post: 15th October 2008, 09:32
  4. stackedWidget with arrows
    By Zergi in forum Newbie
    Replies: 2
    Last Post: 16th July 2008, 10:20
  5. keyboard left and right arrows in qt 3.3.5
    By rajaraob in forum Qt Programming
    Replies: 5
    Last Post: 22nd February 2007, 11:03

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.