Jan. 23, 2016, 9:48 a.m.

Qt

Gnome, PopUp, Qt, всплывающее уведомление, Уведомление

Functionality of the standard notification system tray at times can be insufficient for the implementation of ambitious pans for styling applications. We therefore consider the embodiment of pop-up messages in the style of PopUp DE Gnome notification, namely, as shown in the following figure.

PopUp notification Gnome style

To demonstrate the notification I propose to create an application, which will be a field for entering text, and a button by pressing which will be called a pop-up message.

The message will be displayed in the lower right corner of the tray system tray. This notice must be sure to scale the contents.

Fade-in it will be implemented within 150 milliseconds and the disappearance, after three seconds.

Jan. 17, 2016, 11:37 p.m.

Qt

Charts, Qt, Qt Charts

Перевод официальной новости.

Мы счастливы объявить, что в предстоящий выпуск Qt 5.6.0 будет включён Qt Charts 2.1.0 add-on. Этот выпуск Qt содержит новый функционал, и исправлены баги по пользовательским запросам.

Краткое введение о том новом, что есть в этом модуле: Qt Charts является модулем, который предоставляет комплект простых в использовании компонентов графиков. Доступны следующие типы графиков: LLine, Spline, Area, Scatter, Bar, Pie, Polar and Box-and-Whiskers Chart.

Jan. 8, 2016, 10:53 a.m.

Qt

HotKey, QKeySequence, Qt, RegisterHotKey, WinAPI, горячие клавиши

QKeySequence very different from the sequence of hotkeys in WinAPI . QKeySequence actually is a string in which the separator hotkeys are "+" sign, as well as the sequence ", " , if several sequences. Then, as in WinAPI there are modifiers Alt, Ctrl, Shift, which are represented by an unsigned integer type, and hot key, which is represented by the code keypad.

Let us research the option, when there is one sequence in QKeySequence and it is necessary to register as a global hotkey in WinAPI. To this end, we agree that QKeySequence as as a modifier will have only the Ctrl, Alt, Shift , and as hot keys one of the letters of the English alphabet.

Next to parse QKeySequence write two functions:

  • unsigned int winKeyMod(QKeySequence) - which will return an integer combination of modifiers;
  • char winHotKey(QKetSequence) -which will return the code of the hot key.

Modifiers Alt, Ctrl and Shift option in the bit values have 0b00000001 , 0b00000010 and 0b00000100 respectively, so the logical OR any number of data addition will give the required number of combinations. Hence it is necessary in the method winKeyMod , identify modifiers of the sequence and if any one of the modifier to be added that the method returns.

Jan. 4, 2016, 9:41 a.m.

QML

анимация, material design, Android, Qt, QML

QML does not provide animation interactions clicks Material Design Style for Android by default, but is easily adjusted with the Rectangle primitive. Animation is to one parent, Rectangle, when clicked, you need a second child Rectangle object to stretch the entire area of the parent. At the same time the child object will stretch for a certain time and will appear as an expanding circle, but it will not go beyond its parent.

For clarity, create a list of items, which will produce clicks. To track clicks is used area MouseArea, which will be monitored by the interaction of several signals:

  • onClicked - the signal will stop the animation and the result of the interaction performed with the list;
  • onPressed - when the signal is pressing need to run an animation preset coordinates animated object Rectangle.
  • onReleased - you need to stop the animation when you release the list item;
  • onPositionChanged - when you change the position of the field also need to stop the animation.

To make the animation used PropertyAnimation object. This site is chosen goal of animation, and a list of properties that will be subject to change. In the case of animatable object Rectangl, it is necessary to expand the circle, for that increase the properties width, height and radius with the same value. In order to completely fill the parent object properties will exhibit a finite amount three times greater than the width of the parent element.

Another important property is the parent element:

clip - activating this property (true), we cut the child elements of the object, so that they do not go beyond the boundaries of the parent element.

Jan. 3, 2016, 10:35 a.m.

Qt

Qt, HotKey, RegisterHotKey, UnregisterHotKey, WinAPI, горячие клавиши

To work with global HotKey in Qt5 , there is a virtual method nativeEvent . This method replaces the methods winEvent , x11Event , macEvent of Qt 4.8 .

The especiality in the HotKey to Qt is that if the window is not in focus, that is, it is, for example, will be minimized to the system tray, then registered QShortcut simply will not work. It is therefore necessary to work with the global events from the operating system, that is, go to the realization of the platform-specific code in the application to Qt.

RegisterHotKey

In this example Let us examine the option of working with WinAPI. For this we use the function RegisterHotKey.

BOOL WINAPI RegisterHotKey(
  _In_opt_ HWND hWnd,
  _In_     int  id,
  _In_     UINT fsModifiers,
  _In_     UINT vk
);
Jan. 2, 2016, 11:30 a.m.

Qt

Qt, WinAPI, Windows, автозагрузка, автозапуск

As is known, QSettings class allows you to store application settings in the registry of Windows . Due to this possibility, and a good knowledge of your Windows registry, you can add an application to autostart, or remove it from there, through, for example, the application settings dialog. You can use the checkbox, and if it is marked, then by clicking on the button in the confirmation dialog box to write an application to the startup, otherwise, remove it from the startup.

In any case, it all comes down to the two actions.

Write an application to autostart

#ifdef Q_OS_WIN32
    QSettings settings("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", QSettings::NativeFormat);
    settings.setValue(APPLICATION_NAME, QDir::toNativeSeparators(QCoreApplication::applicationFilePath()));
    settings.sync();
#endif
Jan. 2, 2016, 9:33 a.m.

Qt

JSON, QJsonArray, QJsonDocument, QJsonObject, QJsonValue, QNetworkAccessManager

In the process of writing programs EColor appeared a problem in which it was necessary in some way to notify the user that a new version of the program. The solution to this problem was the presence of JSON file on the site. With QNetworkAccessManager get a JSON file and produce his analysis, thanks to the class library Qt: QJsonDocument , QJsonObject , QJsonArray . In the case of the program on the website EColor contains JSON file with the name of the program, the full version in string form and three entities to the major part of the version, minor and patch version. When parsing the file is compared with the current version of the program that is on the website. If the site is lined with a newer version, the program will notify the user.

Dec. 27, 2015, 8:09 a.m.

Qt

QCustomPlot, QDateTime, Qt, время, график

QCustomPlot Library has the ability to charting the scale of time, which is useful in analyzing the data, which change over time. To do this, you need to install a signature style to the time axis as QCPAxis::ltDateTime. And then set the date and time format. That is, it is possible to display on the axes or the date or time, or simultaneously do both, depending on what you specify formatting. Formatting Rules for QCustomPlot used are the same as for QDateTime , QDate , QTime , classes.

Time coordinate is transmitted in the form of a double number that starts the countdown in seconds from time 1970-01-01T00:00:00 . What to consider when plotting.

I propose to write an application that will build a pseudo-random schedule of income and rubles according to the current time coordinate. At the same time the schedule will be to communicate, that is, zoom and remove it, and move, but only on the horizontal axis. That is, the height of the graph display will not change. Also, we make it possible to change the time format in the coordinate dependence of the visible area of ​​the chart for the time axis. That is, if the visible part of the graph in less than one day, the time-axis signature format will be as follows: hh: mm. Otherwise, the format is " dd MMM yy ".

Building a graph

We create a project and connect it to the library QCustomPlot . Modifications will be subject only mainwindow.h and mainwindow.cpp files. New files will not be added.

Dec. 24, 2015, 9:27 a.m.

QML

Qt, QML, window, Quick, Controls, QtQuick

One of the articles had a chance to answer the question the reader how to implement switching between windows in Q t, so that when you change an inactive window hidden. At the touch of a button opens a second window, and the first closing. And switch back the same way.

Now we ask the same question, but with regard to QML. So, let's see how to implement it on the QML.

Project structre

  • question4.pro - profile project, the default is created and does not change;
  • main.cpp - the main source file, the default is created and does not change;
  • main.qml - qml main file to the main application window;
  • AnotherWindow.qml - type secondary windows project.

AnotherWindow.qml

Explanation of code begin with a secondary application window, since the transmission of information on the button is pressed to open the main application window is realized by a signal. And it is more convenient to describe this moment in the beginning, before proceeding to the main application code.

Dec. 23, 2015, 11:07 a.m.

Qt

Qt, QVector, двумерный, одномерный, массив

Class QVector relates to a container class, and provides access to the items on the index, as well as a number of additional methods for ease of operation.

QVector instance of the class is essentially a one-dimensional array of objects. If you want to set as a vector of two-dimensional array, you can create an instance of a QVector , which will contain other instances QVector .

One-Dimensional array using QVector

For starters keep in Vector-dimensional array of type int:

QVector <int> myVector;

int massive[4] = {1, 2, 3, 4};

for(int i = 0; i < 4; i++)
{
    myVector.push_back(massive[i]);
    qDebug() << "Value " << i << ": " << myVector.value(i);
}

And look at the output qDebug() :

Value  0 :  1
Value  1 :  2
Value  2 :  3
Value  3 :  4
D
Aug. 16, 2019, 11:58 a.m.
Damir

C++ - Тест 003. Условия и циклы

  • Result:92points,
  • Rating points8
D
Aug. 16, 2019, 11:46 a.m.
Damir

C++ - Test 005. Structures and Classes

  • Result:75points,
  • Rating points2
u
Aug. 14, 2019, 1:55 p.m.
unrealproro

C++ - Test 005. Structures and Classes

  • Result:83points,
  • Rating points4
Last comments
Aug. 19, 2019, 6:41 a.m.
Andrej Jankovich

это проблема дистрибутива, попробуйте установить через пакетный менеджер snap Суть проблемы: libQt5Core которая лежит в дистрибутиве требует версию glibc >= 2.25 у вас видимо …
b
Aug. 18, 2019, 5:09 a.m.
bbb116

cqtdeployer /home/aleks/CQtDeployer/bin/cqtdeployer: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.25' not found (required by /home/aleks/CQtDeployer/lib/libQt5Core.so.5) linux mint …
D
Aug. 17, 2019, 8:04 a.m.
Damir

github ChekableTView Правой групповая смена значения при перетаскивании левой как обычно.
Aug. 16, 2019, 12:03 p.m.
Evgenij Legotskoj

Потому, что в минуте 60 секунд
Aug. 16, 2019, 11:16 a.m.
Dmitrij

а почему делитель 60000, а не 1000?
Now discuss on the forum
Aug. 19, 2019, 10:29 a.m.
Aleksej Vnukov

я в дороге, по тому примеру что в есть выше вам чтоб заработало нужно примерно следующее ListModel{ id: list_model } в ListView добавить model:list_model там где кноп…
Aug. 19, 2019, 8:47 a.m.
Pavel K.

bool YourClass::chekIfEmpty(const QString& table) { return getCount(table) == 0;}int YourClass::getCount(const QString& table, const QString& where) { QString command =…
Aug. 19, 2019, 8:29 a.m.
Pavel K.

посмотрите тут , практически тоже самое делал(пробегал по документу). А так в принципе : QFile file(Path);if(file.exist){ file.open(QIODevice::WriteOnly); // ReadWrite for…
Aug. 19, 2019, 2:39 a.m.
grig_p

Здравствуйте! Хотелось бы в своем приложении сделать цетрализованную обработку исключительных ситуаций для их логирования. Переопределил метод notify(): static const int EC_MAINLOOP…
Aug. 15, 2019, 2:19 a.m.
Mihailll

Плюсы и qml отличаются, с++ логичней
Looking for a Job?
14,000.00 руб. - 40,000.00 руб.
Разработчик Qt
Annino, Moscow Oblast, Russia
5,000.00 руб. - 15,000.00 руб.
Дизайнер
Moskovskiy, Moscow, Russia
25,000.00 руб. - 30,000.00 руб.
Разработчик Qt/C++
Barnaul, Altai Krai, Russia

For registered users on the site there is a minimum amount of advertising

EVILEG
About
Services
© EVILEG 2015-2019
Recommend hosting TIMEWEB