in Education by
According to my understanding of QDateEdit's API documentation it creates a widget for editing dates. The only public members it has are constructors. So I basically created a QT widgets application using the QT creator and have added the following code. QTextStream cout(stdout); int main(int argc, char *argv[]) { QApplication a(argc, argv); QDate d1(2002,4,1) QDateEdit dateEdit(d1,0); return EXIT_SUCCESS; } Even though no error is given no widget/window appears either. What am I not getting? JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
call the show method dateEdit.show(); this is required because QDateEdit is a widget, and is not going to be displayed by default... just do: QDateEdit dateEdit(d1,0); dateEdit.show(); edit: to your comment, additional question; Why doesn't a line like QString = InputDialog::getText(....) require the .show() well the function getText is calling that internally: documentation: https://doc.qt.io/archives/qt-4.8/qdialog.html#exec int QDialog::exec() Shows the dialog as a modal dialog, blocking until the user closes it. The function returns a DialogCode result. If the dialog is application modal, users cannot interact with any other window in the same application until they close the dialog. If the dialog is window modal, only interaction with the parent window is blocked while the dialog is open. By default, the dialog is application modal. See also open(), show(), result(), and setWindowModality(). source code: QString QInputDialog::getText(QWidget *parent, const QString &title, const QString &label, QLineEdit::EchoMode mode, const QString &text, bool *ok, Qt::WindowFlags flags, Qt::InputMethodHints inputMethodHints) { QAutoPointer dialog(new QInputDialog(parent, flags)); dialog->setWindowTitle(title); dialog->setLabelText(label); dialog->setTextValue(text); dialog->setTextEchoMode(mode); dialog->setInputMethodHints(inputMethodHints); const int ret = dialog->exec(); // <== here!!!! if (ok) *ok = !!ret; if (ret) { return dialog->textValue(); } else { return QString(); } }

Related questions

0 votes
    According to my understanding of QDateEdit's API documentation it creates a widget for editing dates. The ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 11, 2022 in Education by JackTerrance
0 votes
    According to my understanding of QDateEdit's API documentation it creates a widget for editing dates. The ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 7, 2022 in Education by JackTerrance
0 votes
    I hope my question isn't always the same question. I have a QGraphicsScene. Its items are some ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 20, 2022 in Education by JackTerrance
0 votes
    I want to be able to zoom in my QtCharts using the mouse. The best way to zoom using the mouse ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 6, 2022 in Education by JackTerrance
0 votes
    As it currently stands, this question is not a good fit for our Q&A format. We expect answers to ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 21, 2022 in Education by JackTerrance
0 votes
    On my Windows machine text is displayed to the right of the progress bar. On my Linux machine text ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 2, 2022 in Education by JackTerrance
0 votes
    Which of the following code create n samples of size “size” with probability prob from the binomial? (a) z...
asked Feb 11, 2022 in Education by JackTerrance
0 votes
    I am working on a game in allegro 5 in which I want to create rectangular objects dynamically on screen and make them clickable with mouse ... if ( x >= rect.x && x = rect.y && y...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    How do you create log linear models in R language? (a) loglm() (b) logmn() (c) logfn() (d) ... and Debugging of R Programming Select the correct answer from above options...
asked Feb 12, 2022 in Education by JackTerrance
0 votes
    Which function is used to create a histogram for visualisation in R programming language? (a) Library (b) Hist ... of R Programming Select the correct answer from above options...
asked Feb 13, 2022 in Education by JackTerrance
0 votes
    Which of the following code create a n item vector of random normal deviates? (a) x1...
asked Feb 12, 2022 in Education by JackTerrance
0 votes
    I have a QGraphicsItem element (subclassesed from QGraphicsItem) that has as child a QGraphicsTextItem. The problem ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 16, 2022 in Education by JackTerrance
0 votes
    I'm trying to create two dimensional std::vector, that will hold objects of this class I inherited. ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 27, 2022 in Education by JackTerrance
0 votes
    I'm relatively new to C++, recently moved from C# and Java (and before that, used to work in ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 7, 2022 in Education by JackTerrance
0 votes
    I am currently working on a personal project in C++, and I'm having a lot of fun learning. I just learned some ... MainMenu::~MainMenu(){} void MainMenu::displayMenu() { std::cout...
asked May 3, 2022 in Education by JackTerrance
...