trikRuntime
trikGuiMessageBox.h
Go to the documentation of this file.
1 /* Copyright 2014 - 2015 CyberTech Labs Ltd.
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License. */
14 
15 #pragma once
16 
17 #include <QtCore/qglobal.h>
18 
19 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
20  #include <QtGui/QWidget>
21  #include <QtGui/QLabel>
22  #include <QtGui/QVBoxLayout>
23 #else
24  #include <QtWidgets/QWidget>
25  #include <QtWidgets/QLabel>
26  #include <QtWidgets/QVBoxLayout>
27 #endif
28 
29 #include <QtCore/QString>
30 #include <QtCore/QEventLoop>
31 #include <QtGui/QKeyEvent>
32 
33 #include "mainWidget.h"
34 
35 namespace trikGui {
36 
39 {
40  Q_OBJECT
41 
42 public:
45  explicit TrikGuiMessageBox(QWidget *parent = 0);
46 
49  int exec(const QString &message);
50 
51  void renewFocus() override;
52 
53 protected:
54  void keyPressEvent(QKeyEvent *event) override;
55 
56 private:
57  QVBoxLayout mLayout;
58  QLabel mMessageLabel;
59  QEventLoop mEventLoop;
60 };
61 
62 }
int exec(const QString &message)
Show widget and wait until the user will press any key.
Definition: trikGuiMessageBox.cpp:31
Abstract class for widgets which will be used for conversation with user.
Definition: mainWidget.h:28
void keyPressEvent(QKeyEvent *event) override
Definition: trikGuiMessageBox.cpp:43
Definition: abstractIndicator.h:21
Widget showing some message and waiting until the user will press any key.
Definition: trikGuiMessageBox.h:38
TrikGuiMessageBox(QWidget *parent=0)
Constructor.
Definition: trikGuiMessageBox.cpp:21
void renewFocus() override
Set focus properly on this widget or one of its children.
Definition: trikGuiMessageBox.cpp:38