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. How to read a text in a line edit which is used in a stacked widget?
Forum Updated to NodeBB v4.3 + New Features

How to read a text in a line edit which is used in a stacked widget?

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 249 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.
  • W Offline
    W Offline
    Widdershins_NH
    wrote on last edited by
    #1

    I am working on an application that requires several pages. So i used stacked widget in a mainwindow. There is a sign in page . I want to read and write the text in lineEdit given by the users which will be stored in a text file.
    Can anyone help me with this thanks in advance .
    p.s: I am completely new with qt so if you can give me full description it will be very helpful.

    here is the code.
    Error massage sauys : No member named lineEdit in stackedWidget

    QString Email= ui->stackedWidget-> lineEdit_email->text();
    QString Password = ui->stackedWidget->lineEdit_password->text();

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      First you need to understand What is the QStackWidget & how it works.
      There is nice example given in the Qt Assistant. You can refer it.

      Once you understand this
      You can use the following APIs to get the appropriate widget using the following method.

      int index=0;
      QLineEdit edit = qobject_cast<QLineEdit>(widget(index));

      Index is the index of the Widget you have inserted in StackWidget.

      I'm not sure how you have created individual pages.

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      3

      • Login

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