Let's continue with the standard dialog box of QT. This time we will talk about qcolordialog. This is the color selection dialog box provided by QT. It is also easy to use qcolordialog. QT provides the getcolor () function, which is similar to the getopenfilename () function of qfiledialog and can directly obtain the selected color. We still use the previous qact
Label: style blog HTTP Io OS AR for SP File
Common QT classes
Output text to the console
In the first example, we use STL: Console. cpp
#include
In the second example, we use the qt4 programming library. Console2.cpp
#include
Output
console applicationQfile
Write a line of string to the file File. cpp
#include Output
$ cat myfile You make me want to be a better man.
The following example shows how to output a piece of text to the console
Qt Style Sheets Examples
We'll now see a few examples to get started with using Qt Style Sheets. Style Sheet Usage Customizing the Foreground and Background Colors
Let's start by setting yellow as the background color of all qlineedits in an application. This could is achieved like this:
Qapp->setstylesheet ("Qlineedit {background-color:yellow}");
If we want the property to apply Qlineedits is children (o
Tags: qt gdb makefile parametersIn Qt, to add the relevant compilation parameters in the makefile can be achieved by modifying them in the Xx.pro file:Implemented in Xx.pro by using the Qmake_cxxflags setting (for example, to add gdb debug parameters)Qmake_cxxflags + =-g (may appear in the Xx.pro file is black, others appear to have purple)After recompiling, you can use the GDB command to debug.This article
To add a right-click menu bar in a form, for example, add a menu bar in qtreewidget,
The slot function customcontextmenurequested can be used.(QpointPos).
If it is in QT creator, right-click qtreewidget --> go to slot --
-->Select customcontextmenurequested(QpointPos).
Then, in the newly created customcontextmenurequested(QpointPos) Function to implement the specific menu bar.
In order to determine the right-click position, that is,
Write static dynamic graph with QT, static dynamic histogram with qtRecently, several projects have been successively implemented, requiring the use of curves and bar charts to dynamically display data. Therefore, we have specially studied the qcustomplot open-source Drawing Library! As kimit in the garden said, although qcustomplot is a header file and implementation file, it is easy to use, but the code is much more messy than QWT, and the readabili
fourth argument buttons, the button that declares the dialog box, and the default is to place an OK button. This parameter can be used or the operation, for example we want to have a Yes and a No button, you can use Qmessagebox::yes | Qmessagebox::no, All button types can be found in the Standarbutton enumeration of the Qmessagebox declaration, the fifth parameter DefaultButton is the default selected button, and the default value is Nobutton, That is, which button is not selected. So many para
How to get the screen size in Qt.
First call a static method in the Qapplication class, as follows:
Qdesktopwidget *qapplication::d esktop ()
The Qapplication class is used to manage the control flow and primary settings for GUI applications, with the following derived relationships:
QApplication:QGuiApplication:QCoreApplication:QObject
In the main program, it must be qapplication rather than qguiapplication or qcoreapplication, otherwise there will
The Book of qt4 (1.5 QT overview)
The Book of qt4 Translation
Qt programming Art
---------------------------------------------------------------------------------
Original Name: The Book of QT 4: The art of building QT applications
The Book of QT 4 Chinese version:
the dictionary I designed not only allows you to look up words online, but also has a great feature of a rich local dictionary library : I've added eight types of dictionaries by default, as shown here:because I am a communications professional, so joined the Huawei Communications Dictionary, Electronic Engineering dictionary, and because I love programming, but also added the C language basic function dictionary. Here's how to design a local dictionary:selection of dictionary typesOf Course the
palette = infotextedit-> palette (); // obtain the color palette object for text editing. // qcolor color = qcolordialog: getcolor (qpalette: Base, this ); // The initial color value of the color dialog box is the background color qcolor color = qcolordialog: getcolor (palette. color (qpalette: base), this); // if you click Cancel in the color dialog box, the resulting color is invalid if (color. isvalid () {// qpalette: base is usually used for background color palette. setcolor (qpalette: Bas
Recently used QT5 to do a project interface, in the translation into executable exe, run the file, prompt:This application failed-to-start because it could not find or load the Qt PLATFORM Plugin "Windows"In "".Reinstalling the application may fix this problem.Looked up a lot of information, tried the method, and later found that the D:\Anaconda2\Library\plugins under the platforms folder copied to the project file directory (to copy the entire folder
Qt implements system pallets and qt implements pallets
Most of the software we see usually comes with a system tray, so that the software can run in the background, which is quite good. Today, I checked the demon that comes with Qt. I have a reference in the middle. After implementing this small function, I added this function to my previous project. The effect i
Gray-scale transformation of Qt image processing and qt gray-scale
Changing the brightness and contrast of an image is a common image processing operation, but Qt itself does not provide the corresponding functional code. Therefore, I wrote a simple class to implement these operations. I call this class BrightnessMapper.
The Code is as follows:
#ifndef BRIGHTNE
I wrote a Qt display image control and a qt display image control.
There is no control for displaying images in Qt. We usually use QLabel to display images. However, the QLabel image display capability is weak. For example, image scaling is not supported. So I wrote a simple class myself.
My class supports three image display modes: FIXED_SIZE, CENTRED, AUTO_ZOO
Use Qt. locale to display local data, and use qt. locale to localize
We know that for some applications, we can display different data formats, such as time and money, based on the language selection. In today's routine, we will show you how to use Qt. locale to display data in different formats based on different languages.
import QtQuick 2.0import Ubuntu.Comp
Copyright Notice
Respect Original Works. Reprinted, please maintain the integrity of the article, and in the form of a hyperlink to indicate the original author "tingsking18" and the main site address, so that other friends can ask and correct.
Mixed MFC and QT programming-use QT components in the MFC Program
1.
Create a simpleMFC DialogProgram.
2.
InBool ctestapp: initinstance ()Add to functionQmfc
The QT progress bar Operation example is this article to introduce the content, in QT can use Qprogressbar or the Qprogressdialog to realize the progress bar.
Use of QprogressbarFirst drag a button and a progress bar widget in the designer and initialize it as follows
Ui->progressbar->setrange (0,50000-1); Ui->progressbar->setvalue (0);
Event handling for the button:
void mainwindow::on_pushbutton_clicked (
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.