Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Any obvious reason why this "connect" fails
QtWS25 Last Chance

Any obvious reason why this "connect" fails

Scheduled Pinned Locked Moved Qt Creator and other tools
12 Posts 3 Posters 6.8k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    DrGreg
    wrote on last edited by
    #1

    I'm using Creator (maybe that's important in this case)... but when I run the follow code, the "connect" fails with error msg "Object::connect: No such slot MainWindow::NowLblClicked(QString xxS) in ..\QtSaga\mainwindow.cpp:18" but to my eyes the slot does exist????

    from the mainwindow.h file:

    public slots: void NowLblClicked(QString xxS);

    from the mainwindow.cpp file:

    void MainWindow::NowLblClicked(QString xxS)
    {
    QDate crdate = QDate::currentDate();

    QTime crtime = QTime::currentTime();
    
    
    ui->YearUD->setValue(crdate.year());
    

    The connect statement (from the mainwindow initialization code):

    "connect( ui->NowLbl, S I G N A L(linkActivated(QString)), this, S L O T(NowLblClicked(QString xxS)));"

    What am I missing... I'm sure it's obvious - just I don't see it.

    thanks - greg

    (*) I had to expand out the words signal and slot because the forum is doing something funny if I leave them as in the code ;-( Also, the code lines form the init code - when cut and pasted is several lines, now one single line.

    1 Reply Last reply
    0
    • D Offline
      D Offline
      DenisKormalev
      wrote on last edited by
      #2

      Remove xxS parameter name from SLOT.

      1 Reply Last reply
      0
      • D Offline
        D Offline
        DrGreg
        wrote on last edited by
        #3

        Denis - thanks for the quick reply - remove the xxS in which case? The .h file, the function header in the mainwindow, or the connect? (and yes, I'm very new Qt !!!)

        thanks - greg

        1 Reply Last reply
        0
        • D Offline
          D Offline
          DrGreg
          wrote on last edited by
          #4

          I removed it from the connect... and I don't get the error msg any more... but when I click the label, the connected to code doesn't seem to get control... Will LinkActivated fire for any label? for any label with underlined text? or does something else have to be specified in the label definition for make it "fire'able"? (the label also has openexternallinks checked, and textInteractionFlags set as LinksAccessibleByMouse)

          again - thanks, greg

          1 Reply Last reply
          0
          • M Offline
            M Offline
            mgran
            wrote on last edited by
            #5

            quote author="DrGreg" date="1280420929" I had to expand out the words signal and slot because the forum is doing something funny if I leave them as in the code ;-( Also, the code lines form the init code - when cut and pasted is several lines, now one single line.[/quote]

            If you wrap your code in two @'s (our code tag) it will get treated much better. :) You can find it on the toolbar as well.

            Project Manager - Qt Development Frameworks

            1 Reply Last reply
            0
            • D Offline
              D Offline
              DenisKormalev
              wrote on last edited by
              #6

              Do you have links in your label or underlined text only? You should make them links ("a" tag).

              1 Reply Last reply
              0
              • D Offline
                D Offline
                DrGreg
                wrote on last edited by
                #7

                Denis - Only underlined text... in building an app for a smartphone, one is always looking for ways to conserve real estate; so, I was trying to make a label act as a pushbutton [have done this lots of times in windows desktop apps in Delphi]... since I'm not really interested in using the label as a real hyperlink... I guess I'll use a real button... but question: where would one put the <a.... > tag in the qlabel definition? And if it's there, will the link be automatically executed, ie, call a browser using it, or will simply my slot be called with the text of the link (which in this case, ignored)?

                again - many thanks - greg

                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  DenisKormalev
                  wrote on last edited by
                  #8

                  If you will set openExternalLinks to false then signal will be emitted. If it will be true then signal will not be emitted, but browser will be opened.

                  1 Reply Last reply
                  0
                  • D Offline
                    D Offline
                    DrGreg
                    wrote on last edited by
                    #9

                    Denis - yet again, thank you. If I set openExternalLinks to false, do I still need to set another field to @<a.... >@ to have the signal emitted; or will it happen without the @<a > @ link? The use of the clickable label (mentioned above) I've already change to a very small pushbutton (just to get the prototype up and running)... but for future reference I'm interested [clickable labels make useful less frequently used space-saving pushbuttons... which I'm sure I'll use again.]

                    again - thanks, greg

                    1 Reply Last reply
                    0
                    • D Offline
                      D Offline
                      DrGreg
                      wrote on last edited by
                      #10

                      Marius - it works as you've said (though I also get line numbers.. is there a way to include html (see above message) and not have it "interpreted", simply included as text?? - again, thanks - greg

                      1 Reply Last reply
                      0
                      • M Offline
                        M Offline
                        mgran
                        wrote on last edited by
                        #11

                        @DrGreg: You can also use the currently undocumented [ code ] * [ /code ] (without the spaces), that will render most html as something like this:

                        [code]
                        <ul>
                        <li><a href="http://www.forum.nokia.com/Develop/Qt/Tools/">Download the Nokia Qt SDK at Forum Nokia</a></li>
                        <li><a href="http://conversations.nokia.com/2010/04/27/nokia-rolls-out-qt-sdk-for-unified-mobile-developer-experience/">The Official Nokia Blog: Nokia rolls out the Nokia Qt SDK for unified
                        mobile developer experience</a></li>
                        <li><a href="http://labs.trolltech.com/blogs/2010/04/27/nokia-qt-sdk-what-is-in-and-what-is-not-and…-what-is-it/">Qt Labs Blog: Nokia Qt SDK, what is in and what is not and…. What is it?</a></li>
                        <li><a href="http://blog.qt.nokia.com/2010/04/27/qt-gets-more-mobil/">Qt Blog: Qt gets more mobile today</a></li>
                        <li><a href="http://www.forum.nokia.com/Develop/Qt/">Qt, on Forum Nokia</a></li>
                        <li><a href="http://events.nokia.com/NokiaN8/">Nokia N8, comes with Qt</a></li>
                        </ul>
                        [/code]

                        It will still run it through the normal protective filters and have some color applied to it - but it should come out in fairly good shape :)

                        Project Manager - Qt Development Frameworks

                        1 Reply Last reply
                        0
                        • D Offline
                          D Offline
                          DenisKormalev
                          wrote on last edited by
                          #12

                          MariusG, oops, this undocumented tag slightly crashed design ;)

                          DrGreg, yeah you should use "a" tag to make it working.

                          1 Reply Last reply
                          0

                          • Login

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved