Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] Von SLOT-Funktion aus auf Widgets zugreifen (z.B. setText())

[SOLVED] Von SLOT-Funktion aus auf Widgets zugreifen (z.B. setText())

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 601 Views 1 Watching
  • 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.
  • S Offline
    S Offline
    suggi87
    wrote on last edited by
    #1

    Hallo,

    ich poste hier zuerst mal den relevanten Teil meiner Klasse MainWindow.cpp:

    @
    MainWindow::MainWindow()
    {
    QWidget *window = new QWidget;
    QGridLayout *box = new QGridLayout(window);

    QComboBox *sn1 = new QComboBox();
    QLineEdit *edit1 = new QLineEdit("Audi A3 2.0 TDI ");
    
    QObject::connect(sn1, SIGNAL(currentIndexChanged(int)), this, SLOT(test1()));
    

    ...

    box->addWidget(................ usw.

    ....

    window.show();
    }

    void MainWindow::test1()
    {
    qDebug("hello");

    }
    @

    Ich kann bei einer Änderung des Index von QComboBox sn1 die SLOT-Funktion test1() aufrufen.

    Leider kann ich aber nicht auf die verschiedenen Widgets zugreifen.
    Hier möchte ich z.B. den Text von edit1 ändern.
    (Für jedes Item in der QComboBox sollen später mehrere Felder editiert werden.)

    Wie komme ich an die Widgets ran?

    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