Results 1 to 6 of 6

Thread: I'm so new, I still have that newbe smell

  1. #1
    Join Date
    Jun 2015
    Location
    Soon to be Flordia, USA
    Posts
    4
    Thanks
    1
    Qt products
    Qt4 Qt5 PyQt3 PyQt4
    Platforms
    Unix/X11 Android

    Unhappy I'm so new, I still have that newbe smell

    I'm using Linux Mint 17.1 64bit on a newer computer. I am doing an tabWidget app with one of the tabs being the appointments tab. I need the current date in a label. Here it is

    void mainForm:n_mainTW_currentChanged(int index)
    {
    if(ui->mainTW->currentIndex() == 1)
    {
    QString mdy;
    QDate::toString("MM dd yyyy") *mdy;
    ui->dateLbl->text(mdy);
    }
    }
    Can anyone help me to get this to work with explanation what I did wrong?

    MM

  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: I'm so new, I still have that newbe smell

    What is this code supposed to do?
    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 2015
    Location
    Soon to be Flordia, USA
    Posts
    4
    Thanks
    1
    Qt products
    Qt4 Qt5 PyQt3 PyQt4
    Platforms
    Unix/X11 Android

    Default Re: I'm so new, I still have that newbe smell

    When the user goes to the Appointments tab a label (dateLbl) will display the current date in US format (Month, Day, Year). FYI - each tab will have an equivalent if statement to update items on their respective tabs. So simple it hurts that I can't seem to get a date-to-string statement to just display a date in text. That is why if someone could just rewrite it to do that it will break this brain freeze I seem to be in. Originally, I thought of just doing this ui->dateLbl->text(QDate::toString("MM dd yyyy)); But that didn't work so I started making changes and it just got ugly from there and I got all turned around. So when in deep **** always ask for help. Thanks for anything you might offer.

  4. #4
    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: I'm so new, I still have that newbe smell

    I think you should really work on your C++ before doing anything with Qt.

    Qt Code:
    1. ui->dateLbl->setText(QDate::currentDate().toString());
    To copy to clipboard, switch view to plain text mode 
    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. #5
    Join Date
    Jun 2015
    Location
    Soon to be Flordia, USA
    Posts
    4
    Thanks
    1
    Qt products
    Qt4 Qt5 PyQt3 PyQt4
    Platforms
    Unix/X11 Android

    Default Re: I'm so new, I still have that newbe smell

    Thank you for both bits. I will use the one and put a pin in the other. It just sank in what you were alluding to with brushing up on c++. In my retired world of patches, helping others on PLC problems I sometimes get 'stuck' in a language loop and can't seem to get out of it to do other stuff. That is what happens so if I did a bone head thing, please forgive me my transgressions, part of being as old as dirt. Thank you for your input and advice. Your small nudge broke the loop and that is all that was needed. Hope you will allow me a chance at redemption in the future. Have a better one.
    Last edited by MagikMan; 17th June 2015 at 19:29.

  6. #6
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: I'm so new, I still have that newbe smell

    Being old as dirt is no crime. There are plenty of us old dirt clods kicking around who can code circles around any of those young, inexperienced whippersnappers with their degrees from high-falutin' universities who learned Python and HTML and think they're wizards. Age, treachery, and 40+ years of coding matter.

    Qt is a steep learning curve. I've been at it since 2008 or so, and there are still vast parts of it I don't know and nuances to the parts I do know that I don't use much. This forum and some of the posters with > 2^n posts (n being large) have helped greatly, even if the posts I read don't have immediate relevance.

  7. The following user says thank you to d_stranz for this useful post:

    MagikMan (18th June 2015)

Similar Threads

  1. Replies: 2
    Last Post: 2nd March 2014, 22:49
  2. Replies: 3
    Last Post: 2nd November 2013, 20:12
  3. Newbe questions
    By Doug Broadwell in forum Newbie
    Replies: 2
    Last Post: 18th January 2009, 12:42
  4. newbe question about signals / slots
    By Walsi in forum Qt Programming
    Replies: 19
    Last Post: 20th April 2007, 10:54
  5. 4.1.1 to 4.2 upgrade, newbe question.
    By Doug Broadwell in forum Installation and Deployment
    Replies: 2
    Last Post: 10th October 2006, 19:30

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.