QInputDialog
-
wrote on 1 Feb 2017, 06:32 last edited by
Hi,
I am trying to set default cusor position in linedit in Inputdialog, but its not happening.
I have tried by using setCursorPosition , but its not working.please give me solution.
Thanks in advance.
-
Hi,
I am trying to set default cusor position in linedit in Inputdialog, but its not happening.
I have tried by using setCursorPosition , but its not working.please give me solution.
Thanks in advance.
@DivyaMuthyala Is the line edit empty?
-
Hi,
Can you show your code ?
-
wrote on 2 Feb 2017, 03:56 last edited by yuvaram 2 Feb 2017, 04:01
look at the code which is shared by me, even after issue is not solved, share your code
Widget::Widget(QWidget *parent)
: QWidget(parent)
{
m_PB1 = new QPushButton("ShowInputDialog",this);
connect(m_PB1,SIGNAL(clicked(bool)),this,SLOT(slt_getInputDialog()));
}Widget::~Widget()
{}
void Widget::slt_getInputDialog(){
bool ok;
QString text = QInputDialog::getText(this, tr("QInputDialog::getText()"),
tr("User name:"), QLineEdit::Normal, "Enter here", &ok);}
-
look at the code which is shared by me, even after issue is not solved, share your code
Widget::Widget(QWidget *parent)
: QWidget(parent)
{
m_PB1 = new QPushButton("ShowInputDialog",this);
connect(m_PB1,SIGNAL(clicked(bool)),this,SLOT(slt_getInputDialog()));
}Widget::~Widget()
{}
void Widget::slt_getInputDialog(){
bool ok;
QString text = QInputDialog::getText(this, tr("QInputDialog::getText()"),
tr("User name:"), QLineEdit::Normal, "Enter here", &ok);}
wrote on 2 Feb 2017, 07:41 last edited byThis post is deleted! -
look at the code which is shared by me, even after issue is not solved, share your code
Widget::Widget(QWidget *parent)
: QWidget(parent)
{
m_PB1 = new QPushButton("ShowInputDialog",this);
connect(m_PB1,SIGNAL(clicked(bool)),this,SLOT(slt_getInputDialog()));
}Widget::~Widget()
{}
void Widget::slt_getInputDialog(){
bool ok;
QString text = QInputDialog::getText(this, tr("QInputDialog::getText()"),
tr("User name:"), QLineEdit::Normal, "Enter here", &ok);}
wrote on 2 Feb 2017, 08:00 last edited by@yuvaram
Hi, friend. i tried your code. it is fine at my qt. theQInputDialog lineEdit
can get the cursor when Dialog shown. like the following gif.my code
void Widget::on_btn_clicked() { bool ok; QString text = QInputDialog::getText(this, tr("Title"), tr("User name:"), QLineEdit::Normal, tr("your name at here"),&ok); if (ok && !text.isEmpty()) qDebug() << text; }
My Qt is 5.6 version And OS is Win10
1/8