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 (
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
_ largefile_support ': Macro redefinition1> command-line arguments: see previous definition of 'qt _ largefile_support'Create an empty project using vs2008 and use the same qt4.86 library.
Bytes ------------------------------------------------------------------------------------Summary:1. vs2005 + qt4.53 is used to learn the examples in the book, which is really amazing. Qt 4.53 was released at the end of
Reprinted--*--*----In the development process, often need to exchange data with other systems, the format of data exchange is XML, JSON, etc., JSON as a lightweight data format than XML efficiency, XML needs a lot of tags, which undoubtedly occupy the network traffic, JSON is doing well in this respect, Let's look at the JSON
JSON (JavaScriptObjectNotation) is a lightweight data exchange format. this article mainly introduces how to convert Json objects and strings into json data mosaic and how to use JSON (Summary). For more information, see JSON (JavaScript Object Notation) is a lightweight dat
This is the last part of the Qt standard dialog box. As shown in its name, QInputDialog is used to receive user input. QInputDialog provides some simple static functions to quickly create a dialog box, just as QColorDialog provides the getColor function. First let's take a look at the getText function: 650) this. width = 650; "onclick = 'window. open (" http://blog.51cto.com/viewpic.php? Refimg = "+ this. src) 'align =" top "src =" http://www.bkjia.co
Value passing between Qt forms (Code backup), qt forms
At the beginning, I was confused by the cloud. Now I know a little bit about it. Now assume there is a form, a MainWindow ,:
Click PushButton to transfer the content in the text box to MainWindow and display it as a Label. I have already painted the interface in advance. The following is the backup code:
Form. h:
#ifndef FORM_H#define FORM_H#include
F
This is the last part of the QT standard dialog box. As shown in its name, qinputdialog is used to receive user input. Qinputdialog provides some simple static functions to quickly create a dialog box, just as qcolordialog provides the getcolor function. First, let's take a look at the gettext function:
Bool Isok;
Qstring text = qinputdialog: gettext (null,
"Input dialog" ,
"Please input your comment" ,
Qlineedit: normal,
"Your comment" ,
Isok
Two methods1.QlabelDrag a Label control, and then set the followingUi->label->settext ("Click on the button to transfer to the page.2.QurlIntroducing Header Files#includeAnd then, say, in the method of a button.Qurl url= "http://www.baidu.com"; Qdesktopservices::openurl (URL);Click on the button on the line. (PS: Convert HTTP to file can also be used to locate the filesystem.)QT Development: Open URLs in QT
qmouseevent::globalpos () value is the same, but the type is more precise qpointf6Qpointqwidget::maptoglobal (constqpoint POS)Const;//Convert window coordinates to display coordinates7Qpointqwidget::mapfromglobal (constqpoint POS)Const;//Convert display coordinates to window coordinates8Qpointqwidget::maptoparent (constqpoint POS)Const;//converts the POS obtained from window coordinates to the coordinates of the parent widget9Qpointqwidget::mapfromparent (constqpoint POS)Const;//converts the pa
Okay. Now we are working.
Open the QT creator tool and select "file" and "new file or project"
There are multiple types of projects and files. Here we are mobile development.
Select "mobile application" on the right of "QT Control Project"
Click "select" and the configuration will pop up, for example:
Enter the project name and file path, and click Next to select a device:
There is an introduction befor
Draw the ant line in Qt and the ant line in QtAbstract
If you have used a PS selection tool, you should know what the ant line is. It is a dotted line used to represent the selection. The key is dynamic!
A self-contained example in Qt has a variety of Trace demonstrations, but the final result can only be a static trace, which is not cool enough. So, you should implement the following by yourself.
Let's tak
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.