Results 1 to 2 of 2

Thread: Probelm With QInputDialog...

  1. #1
    Join Date
    Feb 2013
    Location
    Bangalore
    Posts
    2
    Qt products
    Platforms
    Windows

    Default Probelm With QInputDialog...

    here is my code..

    import sys
    from PySide import QtGui


    class Example(QtGui.QWidget):

    def __init__(self):
    super(Example, self).__init__()

    self.initUI()

    def initUI(self):

    self.btn = QtGui.QPushButton('Dialog', self)
    self.btn.move(20, 20)
    self.btn.clicked.connect(self.showDialog)

    self.le = QtGui.QLineEdit(self)
    self.le.move(130, 22)

    self.setGeometry(300, 300, 290, 150)
    self.setWindowTitle('Input dialog')
    self.show()

    def showDialog(self):
    dialog=QtGui.QInputDialog()
    #dialog.setComboBoxItems(["a",'b','bcd'])
    #dialog.textValueChanged.connect(self.fun)
    dialog.setLabelText("asdasd")

    dialog.show()

    dialog.textValueChanged.connect(self.fun)
    text, ok = dialog.getText(self, 'Input Dialog', 'Project Already Exist:')

    if ok:
    self.le.setText(str(text))
    def fun(self,name):
    print "fun is callling",name

    def main():

    app = QtGui.QApplication(sys.argv)
    ex = Example()
    sys.exit(app.exec_())


    if __name__ == '__main__':
    main()


    but it creates two dialog boxes one is from dialog=QtGui.QInputDialog()
    and another one comes from
    text, ok = dialog.getText(self, 'Input Dialog', 'Project Already Exist:')

    i want to create a dialogbox and has a "textValueChanged" signal whenver text change it call fun slot and once i pressed on button it should
    save in text, ok variable
    Could u please help me to find the solution

    Thanks in advance
    Rakesh

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Probelm With QInputDialog...

    QInputDialog::getText() is a convenience function that created and runs a QInputDialog set up for text input.

    You can see this in the C++ documentation because getText() is a static method (can be called without an object of QInputDialog) and it it called getSomething(), which in Qt is a very striong indicator that it is (a) static and (b) a helper/convenience function.

    You can either use getText() or create the dialog instance yourself and use setInputMode() to get the text input version.

    Cheers,
    _

Similar Threads

  1. Probelm with QSqlQuery
    By AndreaCe in forum Qt Programming
    Replies: 1
    Last Post: 17th June 2009, 15:12
  2. Qt 4.4.1 installing probelm, why i get Qt 4.1.4 ?
    By lgrock in forum Installation and Deployment
    Replies: 5
    Last Post: 5th September 2008, 22:48
  3. loadFromData with Pixmap probelm
    By December in forum Qt Programming
    Replies: 5
    Last Post: 12th June 2008, 23:16
  4. QCcompleter , colum probelm
    By deepinlife in forum Qt Programming
    Replies: 7
    Last Post: 10th April 2008, 07:46
  5. Probelm after porting from Qt 3.3.4 to Qt 4.2.2
    By joseph in forum Qt Programming
    Replies: 12
    Last Post: 31st May 2007, 14:34

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.