QInputDialog
-
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 ?
-
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);}
-
@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