Results 1 to 19 of 19

Thread: Calender

  1. #1
    Join Date
    Apr 2011
    Posts
    12
    Qt products
    Qt3
    Platforms
    Symbian S60

    Default Calender

    Is it possible for me to represent each day in calender in button,so that i can interact with each of the day for particular process..

  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: Calender

    Yes, its possible.
    ==========================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. #3
    Join Date
    Apr 2011
    Posts
    12
    Qt products
    Qt3
    Platforms
    Symbian S60

    Default Re: Calender

    Can u please tell me how it can be done...as i have created array of button..that looks like

    1 2 3 4 5 6 7
    8 9 10........
    .......31

    each of these number r shown in button...now hw can i change the position of each button depending upon the month ie if i change my month from april to may
    than the position of the button changes as per calender work..so what logic i hv to use to implement this i want to knw..

    thanks

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Calender

    Here are some thoughts:
    • Create 31 buttons. Create a 7x5 grid layout and move the buttons to the appropriate cells for the month (and hide 29, 30, 31 as required)
    • Create 35 buttons and put them into a 7x5 grid layout. Set the labels and enable disable the correct buttons for the month.

  5. #5
    Join Date
    Apr 2011
    Posts
    12
    Qt products
    Qt3
    Platforms
    Symbian S60

    Default Re: Calender

    would u provide some code regarding this..as i am new in QT..

  6. #6
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Calender

    If you are new to Qt then it is very important that you know where to find the manual.
    Open Qt Assistant and search for "Layout Examples" and look at the "Basic Layouts Example". Also read the docs for QGridLayout.

    If you are targeting S60 then Qt Quick may also be of interest, but I cannot help at all with that.

  7. #7
    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: Calender

    would u provide some code regarding this.
    maybe, if you would provide a concrete description of the problem you have?
    ==========================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.

  8. #8
    Join Date
    Apr 2011
    Posts
    12
    Qt products
    Qt3
    Platforms
    Symbian S60

    Default Re: Calender

    Problem is that instead of representing all day that is 1 to 31 in grid that is given in the calender widget in qtdesigner part..i hv to built my own custom calender where i represent each day ie from 1 to 31 in buttons...so that i can interact with each day as i want..either by onclick or onpress function..so if suitable can u provide me the code for that..

    thanks

  9. #9
    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: Calender

    so if suitable can u provide me the code for that.
    Sure.
    Do you want a special skin for it as well?
    ==========================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.

  10. #10
    Join Date
    Apr 2011
    Posts
    12
    Qt products
    Qt3
    Platforms
    Symbian S60

    Default Re: Calender

    yeh..if possible

  11. #11
    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: Calender

    Sure, I am right on it.
    Should the user be able to use Chinese calendar as well?
    Or you want only the Gregorian?
    ==========================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.

  12. #12
    Join Date
    Apr 2011
    Posts
    12
    Qt products
    Qt3
    Platforms
    Symbian S60

    Default Re: Calender

    no jst want Gregorian..

  13. #13
    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: Calender



    I give up.
    ==========================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.

  14. #14
    Join Date
    Apr 2011
    Posts
    12
    Qt products
    Qt3
    Platforms
    Symbian S60

    Default Re: Calender

    i just sent u the interface design...u just check it whether it possible to bulid like that..or not..means whether we can use buttons in day as shown in interface as i hv send..if possible plz send me the code
    [IMG]file:///C:/Users/PT356110002/Desktop/image.html[/IMG]


    Added after 39 minutes:


    i had used the calender widget in one dialog ie dialog1.h...now when i click any of the day in calender widget than i went to another dialog ie dialog2.ui,there is one button in dialog2.ui...now when i click the button in dialog2 than i again went to dialog1.ui..but when i do so i need some changes in calender widget such color changes in each day..

    The problem is that when i do the same thing in single dialog then it works...but when i perform this action in another dialog than error occurs..that is calender object not found..so i can i resolve this bug..
    Last edited by anshumanBorah; 13th April 2011 at 12:31.

  15. #15
    Join Date
    Aug 2009
    Location
    Belgium
    Posts
    310
    Thanks
    10
    Thanked 31 Times in 25 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Calender

    Hi anshumanBorah,

    You should learn the concept of irony. High-flyer had no intention of giving you the code. No-one in this forum will just give some piece of code to someone who doesn't spend any effort in trying to find the solution himself.

    To get you started (perhaps not 100% correct but you'll get the idea) :
    Make a form in designer, and put a QFrame on in where you want all your buttons.
    Next, try and create two QPushButtons in the constructor of your form class (after the setupUi(this) statement) and put them on your form or in the QFrame.
    If you understand this, try and create a QGridLayout in the constructor of your form class and add it to the QFrame. Then add the buttons to the QGridLayout.
    If this works, add buttons for all the days to the grid layout.

    Good luck,
    Marc

  16. #16
    Join Date
    Apr 2011
    Posts
    12
    Qt products
    Qt3
    Platforms
    Symbian S60

    Default Re: Calender

    thanks for ur suggestion..one more query

    how can i call a function of one dialog from anothe dialog...

  17. #17
    Join Date
    Aug 2009
    Location
    Belgium
    Posts
    310
    Thanks
    10
    Thanked 31 Times in 25 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Calender

    Aaaargh..... not again ..... That question has been asked many, many times on this forum.

    A dialog is an instance of a class. To be able to call one of its methods, you have to have a reference or pointer to that instance. A quick-and-dirty way to do this is to create a global variable that is accessible from the code in both your dialogs.

    This is very basic C++. If you don't know C++ already, you should really really learn it first before starting to use Qt.

    Best regards,
    Marc

  18. #18
    Join Date
    Apr 2011
    Posts
    12
    Qt products
    Qt3
    Platforms
    Symbian S60

    Default Re: Calender

    Actually i had done this but when i return from one dialog to another,the Interface design is change..suppose i had dialog named ss.ui contain buttons?supose there is another dialog hh.ui...In first dialog i write a code like this...

    hh s(this)//create a instance of second dialog
    s.show();
    s.exec();
    after executing i came to second dialog..in second dialog cpp file when i write the code like this..
    ss a(this)//create a instance of first dialog
    a.show();

    it will not work...but if i write like this..
    ss *a=new ss();
    a.show();

    it will work but once i return to first dialog the size of button become smaller as compared it is actually constructed..so hw can i solve this problem..

  19. #19
    Join Date
    Jan 2009
    Location
    Germany
    Posts
    131
    Thanks
    11
    Thanked 16 Times in 16 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Calender

    Please use code tags and show original code. Did you read QDialog::exec and do you understand the difference to QWidget::show?

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.