I created my own MyCheckBox class and using a PushButton for switching to edit mode that appears LineEdit.
#include "mycheckbox.h"
{
}
void MyCheckBox
::setname(QString d
) // my new slot {
setText(d);
}
main.cpp code:
MyCheckBox ch;
lay.addWidget(&ch,0,0);
lay.addWidget(&le,0,1);
wdg.show();
#include "mycheckbox.h"
MyCheckBox::MyCheckBox(QWidget *parent) : QCheckBox(parent)
{
}
void MyCheckBox::setname(QString d) // my new slot
{
setText(d);
}
main.cpp code:
QWidget wdg;
QLineEdit le;
MyCheckBox ch;
QGridLayout lay(&wdg);
lay.addWidget(&ch,0,0);
lay.addWidget(&le,0,1);
QObject::connect(&le, SIGNAL(textChanged(QString)), &ch, SLOT(setname(QString)));
wdg.show();
To copy to clipboard, switch view to plain text mode
any other idea?
Bookmarks