Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. Turkish
  4. QT Gui ile Oluşturulan objelerden(Combobox,QtLineEdit,QLabel) bilgi alma
Qt 6.11 is out! See what's new in the release blog

QT Gui ile Oluşturulan objelerden(Combobox,QtLineEdit,QLabel) bilgi alma

Scheduled Pinned Locked Moved Solved Turkish
3 Posts 2 Posters 2.0k 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.
  • T Offline
    T Offline
    TpmSS
    wrote on last edited by TpmSS
    #1

    Merhaba, Qt de QWidget ile oluşturulan arayüz üzerinde for dögüsüyle layoutlar oluşturuyorum ve bu Layoutların sayısı bir listedeki sayıya bağlı. Bu Layout içerisine 2 Adet QLabel, 1 adet QLineEdit ve Combobox koyuyorum. Sonradan Bu arayüz penceresinde combobox değişebiliyor veya QlineEdit içerisine bir değer yazılıyor. Son olarak bu Layout içersindeki değerlerin hepsini bir QString içersinde tututuyorum. Sorun şu ki QString değeri for döngüsünde son değerde örneğin list.size() 3 ise en son değerleri getiriyor.Bu layou değerlerinin hepsini kullanıcı işlem yaptıktan sonra nasıl alabilirim ?? Örneğin bir QStringList içerisinde toplayabilir miyim ?```
    //your code here

        QHBoxLayout *Layout;
        QLabel *Lastlabel;
        QLabel *label;
        QLineEdit *lineEdit;
        QComboBox *comboBox;
    	
    	for(int i=0; i < ObjectCoord.size() ;i++)
    	{
             Layout= new QHBoxLayout();
             Layout->setSpacing(6);
             Layout->setObjectName(QString::fromUtf8("FindingLayout"));
             Lastlabel= new QLabel();
            Lastlabel->setObjectName(QString::fromUtf8("findings_label"));
    	Lastlabel->setText(QString("Kalite Noktası %1: Merkez=%2, Value=%3,").arg(i+1).arg(ObjectCoord[i][0]).arg(ObjectCoord[i][1]));
    
            QFont font;
            font.setFamily(QString::fromUtf8("Calibri"));
            font.setPointSize(10);
            font.setBold(true);
            font.setWeight(75);
            Lastlabel->setFont(font);
    
            Layout->addWidget(Lastlabel);
    
            label = new QLabel();
            label->setObjectName(QString::fromUtf8("label"));
            label->setMaximumSize(QSize(60, 16777215));
            label->setFont(font);
    	label->setText("Possability:");
            Layout->addWidget(label);
    
            lineEdit = new QLineEdit();
            lineEdit->setObjectName(QString::fromUtf8("lineEdit"));
            lineEdit->setMaximumSize(QSize(50, 16777215));
    	lineEdit->setText("%");
    		
            Layout->addWidget(lineEdit);
    
            comboBox = new QComboBox();
            comboBox->setObjectName(QString::fromUtf8("comboBox"));
            comboBox->setMinimumSize(QSize(0, 25));
            comboBox->setMaximumSize(QSize(90, 16777215));
    	comboBox->addItem("1.sınıf");
    	comboBox->addItem("2.sınıf");
    	comboBox->addItem("3.sınıf");
    	comboBox->addItem("None");
    	
            Layout->addWidget(comboBox);
            this->ui.verticalLayout->addLayout(Layout);
    	QString last = QString(Lastlabel->text() + label->text() + lineEdit->text() + comboBox->currentText());
    	}
    }
    1 Reply Last reply
    0
    • T Offline
      T Offline
      TpmSS
      wrote on last edited by
      #2

      for föngüsüyle oluşturulan objeler üzerinden QCombobox ve QlineEdit üzerinden bilgi almak istiyorsam ve bu bilgilerin hangisine ait olduğu, QList<QCombobox*> list1 ve QList<QlineEdit*> list2 adlı 2 liste oluşturur ve her for döngüsüne girdiğinde bu listelere objeleri eklersem ,son olarak bu bilgileri,

      QString name = QString("sıra :%1 , LineEditValue: %2, ComboboxValue: %3").arg(i+1).arg(this->list2[i]->text()).arg(this->list1[i]->currentText());

      şeklinde görebiliriz.

      1 Reply Last reply
      0
      • A.A.SEZENA Offline
        A.A.SEZENA Offline
        A.A.SEZEN
        wrote on last edited by
        #3

        for döngüsüyle bileşeni oluşturduğunuz yerde olay işleyiciyide yazarsanız sonradan erişme sorununuz olmaz. Her bileşen kendi hizmetini gördürür.

        connect(lineEdit, &QLineEdit::editingFinished, this, [=]() { // işlem kodu ya da işlem fonksiyonu buraya.    });
        
        //////
        connect(comboBox, &QComboBox::currentTextChanged, this, [=]() { // işlem kodu ya da fonksiyonu buraya    });
        

        Kolay gelsin.
        Aykut

        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