Results 1 to 12 of 12

Thread: QPropertyAnimation and QStackedLayout:functionality.

  1. #1
    Join Date
    May 2010
    Posts
    100
    Thanks
    1
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default QPropertyAnimation and QStackedLayout:functionality.

    Dear All,

    I am developing a GUI application for the touch screen LCD,in that i am having some problems.

    (1) i have QT-4.6.2 ,but it doesn't have QPropertyAnimation class.Where it has been released with this version.
    (2) I am working with QStackedLayout and QTabWidget, so is there any requirement like tab key provided in keyboard, because i have developed a keyboard with the QSignalmapper class as per our requirement. So, i dont have any Tab key.

  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: QPropertyAnimation and QStackedLayout:functionality.

    Quote Originally Posted by savaliya_ambani View Post
    (1) i have QT-4.6.2 ,but it doesn't have QPropertyAnimation class.
    How do you know you don't have this class?

    (2) I am working with QStackedLayout and QTabWidget, so is there any requirement like tab key provided in keyboard, because i have developed a keyboard with the QSignalmapper class as per our requirement. So, i dont have any Tab key.
    I have no idea what you are asking about.
    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
    May 2010
    Posts
    100
    Thanks
    1
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: QPropertyAnimation and QStackedLayout:functionality.

    Thanks.

    Forget about the previous question.

    Let me explain you. I am trying to develop a menu which has number of menus of the same geometry,but with different pushbuttons on each menu page. i have used QSignalmapper class, and mapped each button with SLOT(MenuEvent(int)). This will pass integer respective to that button.

    I want to display respective menu page as the each button pressed. I dont want to use QListBox or QComboBox . I want direct linking between QSignalMaper and MenuEvent(int ).

    I have tried this.

    /*************start*******************/
    Widge w;
    QSignalMapper *btnmapper;
    connect(btnmapper,SIGNAL(mapped(int)), this, SLOT(MenuEvent(int)));

    QStackedLayout *MenuStack;
    MenuStack->insertWidget(15,menupag1);
    //No one has any parent,Index is as same as button number ,so that i can
    setCurrentIndex(int) directly
    MenuStack->insertWidget(12,menupag2);
    MenuStack->insertWidget(65,menupag3);
    MenuStack->insertWidget(45,menupag4);

    QVBoxLayout *mainlayout;
    mainlayout=new QVBoxLayout(w); //here parent is top widget ,i.e. w
    setLayOut(mainlayout);


    void widget::MenuEvent(int index)
    {
    MenuStack.setCuurentIndex(index);
    }

    When i run this,i can get only the top widget and when i press button on this page,it goes to the MenuEvent(int),but no menupage can be seen.
    I have also tried with the MenuStack.addWidget(menupagex),but still no success.

  4. #4
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QPropertyAnimation and QStackedLayout:functionality.

    From the docs or QStackedLayout::insertWidget()
    Inserts the given widget at the given index in this QStackedLayout. If index is out of range, the widget is appended (in which case it is the actual index of the widget that is returned).
    So you have to store the relation of your number and the index in a member variable, or set the real index number to the signal mapper.

  5. #5
    Join Date
    May 2010
    Posts
    100
    Thanks
    1
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: QPropertyAnimation and QStackedLayout:functionality.

    Thanks Lykurg.

    yes ,i have set the real index number of a particular button with its sub menu page also.

    i can also directly connect the signalmapper's mapped(int) to with the setcurrentindex(int).
    connect(signalmapper,SIGNAL(mapped(int)),Menustack , setCurrentIndex(int));
    but ,this is also not working.

    is it that i can link only QComboBox and QListWidget witht the QStackeLayout's setcurrentindex(int) ?

  6. #6
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QPropertyAnimation and QStackedLayout:functionality.

    Quote Originally Posted by savaliya_ambani View Post
    is it that i can link only QComboBox and QListWidget witht the QStackeLayout's setcurrentindex(int) ?
    You can. Most like you have somewere a minor error which blocks the change. So please make sure the right indexes are delivered etc. Best you would do a simple, compileable and minimal example reproducing your problem. Then we could see your acctual code and maybe find the error. (because you pasted code is not consistent and would not work. Also please use the [code] tags next time)

  7. #7
    Join Date
    May 2010
    Posts
    100
    Thanks
    1
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: QPropertyAnimation and QStackedLayout:functionality.

    Dear Lykurg,

    i have done by other way.

    connect(signalmapper,SIGNAL(mapped(int)),widget, SLOT(MenuEvent(int)));

    void widget::MenuEvent(int index)
    {
    if(index == menupage1)
    {
    MenuStack->setCurrentIndex(0);
    }

    if(index == menupage2)
    {
    MenuStack->setCurrentIndex(1);
    }

    if(index == menupage1)
    {
    MenuStack->setCurrentIndex(2);
    }

    if(index == menupage1)
    {
    MenuStack->setCurrentIndex(3);
    }


    }

    But, still this is not showing any thing. Only the TOP Widge is what i can see.

  8. #8
    Join Date
    May 2010
    Posts
    100
    Thanks
    1
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: QPropertyAnimation and QStackedLayout:functionality.

    Dear All,

    I have also run the another test code with same but minimized functionality,but still
    it is having the problem,the same as shown above.

    when it comes into :
    void widget::MenuEvent(int index)
    {
    }

    The instruction i am writing for setting the index ,MenuStack.setCurrentIndex(n) ;is not taking any effect.

    what can be the related issue with this? Dear in my organisation it is very difficult to post the module code i am working. i can only explain the flow:

    * create the main widget,on which there are forur buttons,each for one menu page
    * create anohter four widget ,which will be my menu pages with no parent
    *connect mapped(int) with the MenuEvent(int) slot.
    *add all four menu page into QVBoxLayout object
    * set object layout
    *And finally Handle the event and do setCurrentIndex( int).

    This is what i have done. I think what i have shown and discussed is enough.

  9. #9
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QPropertyAnimation and QStackedLayout:functionality.

    Quote Originally Posted by savaliya_ambani View Post
    But, still this is not showing any thing. Only the TOP Widge is what i can see.
    As told, your code is meaningless and one can nothing see. So please provide a minimal compilable example, reproducing your problem.

    Side note: use else or better a switch statement to fasten up your code.

  10. #10
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QPropertyAnimation and QStackedLayout:functionality.

    Quote Originally Posted by savaliya_ambani View Post
    when it comes into :
    void widget::MenuEvent(int index)
    {
    }
    Did it come so far? Have you check if the slot is actually called?

    * create the main widget,on which there are forur buttons,each for one menu page
    * create anohter four widget ,which will be my menu pages with no parent
    *connect mapped(int) with the MenuEvent(int) slot.
    *add all four menu page into QVBoxLayout object
    * set object layout
    *And finally Handle the event and do setCurrentIndex( int).

    This is what i have done. I think what i have shown and discussed is enough.
    No that is not enough, because of that decription it should work. And you should not post your project, you should strip it down, that only the problem is left.

    How did you set the signal mapper of?

  11. #11
    Join Date
    May 2010
    Posts
    100
    Thanks
    1
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: QPropertyAnimation and QStackedLayout:functionality.

    yes, it comes here:
    void widget::MenuEvent(int index)
    {
    }

    The signal mapper is from the main widget. And when i take any menu page,i passed this *signalmapper into the class created for taking object of each menu page. And in that class it receives the refrence to the signalmapper and
    mappes its own buttons with this signalmapper.

    thats it.
    only problem is that setCurrent Index has no effect.

  12. #12
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QPropertyAnimation and QStackedLayout:functionality.

    Quote Originally Posted by savaliya_ambani View Post
    only problem is that setCurrent Index has no effect.
    Well last statement of mine: setCurrentIndex works well, so it is not a problem of Qt. Your syntax seems to be OK according to what you have said. But without real (not complete) code I can't help further, since my crystal ball is currently out of order, unfortunately.

Similar Threads

  1. QStackedLayout / QStackedWidget
    By morraine in forum Newbie
    Replies: 15
    Last Post: 12th July 2013, 10:16
  2. Using QPropertyAnimation with QGraphicsPixmapItem
    By Luc4 in forum Qt Programming
    Replies: 8
    Last Post: 29th March 2010, 10:47
  3. Replies: 1
    Last Post: 8th January 2010, 13:21
  4. Scrollbars for QStackedLayout
    By JohannesMunk in forum Newbie
    Replies: 0
    Last Post: 6th December 2009, 17:50
  5. QStackedLayout vs. QStackedWidget
    By bruccutler in forum Qt Programming
    Replies: 1
    Last Post: 13th March 2007, 00:43

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.