Qt编程之实现属性窗口编辑器
类似于这种:
就是右下角这个框,有属性名字和对应的value编辑。
这个Widget是作为一个QDockWidget被添加到QMainWindow中的。QMainWindow必须要有centralWidget才能添加DockWidget。DockWidget是可以浮动于centralWidget周边(上下左右)的一种Widget。QMainWindow中有addDockWiget这相应的函数添加。
而QDockWidget中可以设置相应的Widget,这个Widget(实际上就是属性编辑浏览窗口。)这个Widget实际上不是Qt Native自带的。而是Qt的解决方案中提供的Widget,也就是别人帮你封装做好了Widget,拿来用就可以了。这个Widget就是QtPropertyBrowser
样例代码:
nodeproperty.h 此类继承了QDockWidget
#ifndef NODE_PROPERTY_H
#define NODE_PROPERTY_H #include <QObject>
#include <QDockWidget>
#include "diagramitem.h" QT_BEGIN_NAMESPACE class QDockWidget;
class QtVariantPropertyManager;
class QtProperty;
class QtVariantProperty;
class QtVariantEditorFactory;
class QtTreePropertyBrowser;
QT_END_NAMESPACE class NodePropertyWidget:public QDockWidget
{
public: NodePropertyWidget(DiagramItem::DiagramType type, QWidget* parent = );
~NodePropertyWidget(); private:
void createProcessTreeProperty();
void createDisplayTreeProperty();
void createArrowTreeProperty(); private:
QtVariantPropertyManager *variantManager;
QtProperty *topItem;
QtVariantProperty *item;
QtVariantEditorFactory *variantFactory;
QtTreePropertyBrowser *variantEditor;
}; #endif
nodeproperty.cpp
#include <QDate>
#include <QLocale>
#include <QDockWidget>
#include <QSizePolicy> #include "qtpropertymanager.h"
#include "qtvariantproperty.h"
#include "qttreepropertybrowser.h" #include "nodeproperty.h" NodePropertyWidget::NodePropertyWidget(DiagramItem::DiagramType type, QWidget * parent) :QDockWidget(parent)
{ switch (type)
{
case DiagramItem::Process:
setWindowTitle("Process Property");
setFloating(true); setAllowedAreas(Qt::RightDockWidgetArea);
setSizePolicy(QSizePolicy::Policy::Preferred, QSizePolicy::Policy::Preferred);
createProcessTreeProperty();
break;
case DiagramItem::Display:
setWindowTitle("Display Property");
setFloating(true); setAllowedAreas(Qt::RightDockWidgetArea);
setSizePolicy(QSizePolicy::Policy::Preferred, QSizePolicy::Policy::Preferred);
createDisplayTreeProperty();
break;
case DiagramItem::Line:
setWindowTitle("Arrow Property");
setFloating(true); setAllowedAreas(Qt::RightDockWidgetArea);
setSizePolicy(QSizePolicy::Policy::Preferred, QSizePolicy::Policy::Preferred);
createArrowTreeProperty();
break;
default:
break;
}
} NodePropertyWidget::~NodePropertyWidget()
{ delete variantManager;
delete variantFactory;
delete variantEditor;
} void NodePropertyWidget::createProcessTreeProperty(){ variantManager = new QtVariantPropertyManager(); int i = ;
topItem = variantManager->addProperty(QtVariantPropertyManager::groupTypeId(),
QString::number(i++) + QLatin1String("Process Property")); item = variantManager->addProperty(QVariant::Bool, QString::number(i++) + QLatin1String(" Bool Property"));
item->setValue(true);
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::Int, QString::number(i++) + QLatin1String(" Int Property"));
item->setValue();
item->setAttribute(QLatin1String("minimum"), );
item->setAttribute(QLatin1String("maximum"), );
item->setAttribute(QLatin1String("singleStep"), );
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::Int, QString::number(i++) + QLatin1String(" Int Property (ReadOnly)"));
item->setValue();
item->setAttribute(QLatin1String("minimum"), );
item->setAttribute(QLatin1String("maximum"), );
item->setAttribute(QLatin1String("singleStep"), );
item->setAttribute(QLatin1String("readOnly"), true);
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::Double, QString::number(i++) + QLatin1String(" Double Property"));
item->setValue(1.2345);
item->setAttribute(QLatin1String("singleStep"), 0.1);
item->setAttribute(QLatin1String("decimals"), );
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::Double, QString::number(i++) + QLatin1String(" Double Property (ReadOnly)"));
item->setValue(1.23456);
item->setAttribute(QLatin1String("singleStep"), 0.1);
item->setAttribute(QLatin1String("decimals"), );
item->setAttribute(QLatin1String("readOnly"), true);
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::String, QString::number(i++) + QLatin1String(" String Property"));
item->setValue("Value");
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::String, QString::number(i++) + QLatin1String(" String Property (Password)"));
item->setAttribute(QLatin1String("echoMode"), QLineEdit::Password);
item->setValue("Password");
topItem->addSubProperty(item); // Readonly String Property
item = variantManager->addProperty(QVariant::String, QString::number(i++) + QLatin1String(" String Property (ReadOnly)"));
item->setAttribute(QLatin1String("readOnly"), true);
item->setValue("readonly text");
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::Date, QString::number(i++) + QLatin1String(" Date Property"));
item->setValue(QDate::currentDate().addDays());
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::Time, QString::number(i++) + QLatin1String(" Time Property"));
item->setValue(QTime::currentTime());
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::DateTime, QString::number(i++) + QLatin1String(" DateTime Property"));
item->setValue(QDateTime::currentDateTime());
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::KeySequence, QString::number(i++) + QLatin1String(" KeySequence Property"));
item->setValue(QKeySequence(Qt::ControlModifier | Qt::Key_Q));
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::Char, QString::number(i++) + QLatin1String(" Char Property"));
item->setValue(QChar());
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::Locale, QString::number(i++) + QLatin1String(" Locale Property"));
item->setValue(QLocale(QLocale::Polish, QLocale::Poland));
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::Point, QString::number(i++) + QLatin1String(" Point Property"));
item->setValue(QPoint(, ));
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::PointF, QString::number(i++) + QLatin1String(" PointF Property"));
item->setValue(QPointF(1.2345, -1.23451));
item->setAttribute(QLatin1String("decimals"), );
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::Size, QString::number(i++) + QLatin1String(" Size Property"));
item->setValue(QSize(, ));
item->setAttribute(QLatin1String("minimum"), QSize(, ));
item->setAttribute(QLatin1String("maximum"), QSize(, ));
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::SizeF, QString::number(i++) + QLatin1String(" SizeF Property"));
item->setValue(QSizeF(1.2345, 1.2345));
item->setAttribute(QLatin1String("decimals"), );
item->setAttribute(QLatin1String("minimum"), QSizeF(0.12, 0.34));
item->setAttribute(QLatin1String("maximum"), QSizeF(20.56, 20.78));
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::Rect, QString::number(i++) + QLatin1String(" Rect Property"));
item->setValue(QRect(, , , ));
topItem->addSubProperty(item);
item->setAttribute(QLatin1String("constraint"), QRect(, , , )); item = variantManager->addProperty(QVariant::RectF, QString::number(i++) + QLatin1String(" RectF Property"));
item->setValue(QRectF(1.2345, 1.2345, 1.2345, 1.2345));
topItem->addSubProperty(item);
item->setAttribute(QLatin1String("constraint"), QRectF(, , , ));
item->setAttribute(QLatin1String("decimals"), ); item = variantManager->addProperty(QtVariantPropertyManager::enumTypeId(),
QString::number(i++) + QLatin1String(" Enum Property"));
QStringList enumNames;
enumNames << "Enum0" << "Enum1" << "Enum2";
item->setAttribute(QLatin1String("enumNames"), enumNames);
item->setValue();
topItem->addSubProperty(item); item = variantManager->addProperty(QtVariantPropertyManager::flagTypeId(),
QString::number(i++) + QLatin1String(" Flag Property"));
QStringList flagNames;
flagNames << "Flag0" << "Flag1" << "Flag2";
item->setAttribute(QLatin1String("flagNames"), flagNames);
item->setValue();
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::SizePolicy, QString::number(i++) + QLatin1String(" SizePolicy Property"));
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::Font, QString::number(i++) + QLatin1String(" Font Property"));
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::Cursor, QString::number(i++) + QLatin1String(" Cursor Property"));
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::Color, QString::number(i++) + QLatin1String(" Color Property"));
topItem->addSubProperty(item); variantFactory = new QtVariantEditorFactory(); variantEditor = new QtTreePropertyBrowser();
variantEditor->setFactoryForManager(variantManager, variantFactory);
variantEditor->addProperty(topItem);
variantEditor->setPropertiesWithoutValueMarked(true);
variantEditor->setRootIsDecorated(false); setWidget(variantEditor); //variantEditor->show(); } void NodePropertyWidget::createDisplayTreeProperty(){ variantManager = new QtVariantPropertyManager(); int i = ;
topItem = variantManager->addProperty(QtVariantPropertyManager::groupTypeId(),
QString::number(i++) + QLatin1String(" Display Property")); item = variantManager->addProperty(QVariant::Bool, QString::number(i++) + QLatin1String(" Bool Property"));
item->setValue(true);
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::Int, QString::number(i++) + QLatin1String(" Int Property"));
item->setValue();
item->setAttribute(QLatin1String("minimum"), );
item->setAttribute(QLatin1String("maximum"), );
item->setAttribute(QLatin1String("singleStep"), );
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::Int, QString::number(i++) + QLatin1String(" Int Property (ReadOnly)"));
item->setValue();
item->setAttribute(QLatin1String("minimum"), );
item->setAttribute(QLatin1String("maximum"), );
item->setAttribute(QLatin1String("singleStep"), );
item->setAttribute(QLatin1String("readOnly"), true);
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::Double, QString::number(i++) + QLatin1String(" Double Property"));
item->setValue(1.2345);
item->setAttribute(QLatin1String("singleStep"), 0.1);
item->setAttribute(QLatin1String("decimals"), );
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::Double, QString::number(i++) + QLatin1String(" Double Property (ReadOnly)"));
item->setValue(1.23456);
item->setAttribute(QLatin1String("singleStep"), 0.1);
item->setAttribute(QLatin1String("decimals"), );
item->setAttribute(QLatin1String("readOnly"), true);
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::String, QString::number(i++) + QLatin1String(" String Property"));
item->setValue("Value");
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::String, QString::number(i++) + QLatin1String(" String Property (Password)"));
item->setAttribute(QLatin1String("echoMode"), QLineEdit::Password);
item->setValue("Password");
topItem->addSubProperty(item); // Readonly String Property
item = variantManager->addProperty(QVariant::String, QString::number(i++) + QLatin1String(" String Property (ReadOnly)"));
item->setAttribute(QLatin1String("readOnly"), true);
item->setValue("readonly text");
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::Date, QString::number(i++) + QLatin1String(" Date Property"));
item->setValue(QDate::currentDate().addDays());
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::Time, QString::number(i++) + QLatin1String(" Time Property"));
item->setValue(QTime::currentTime());
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::DateTime, QString::number(i++) + QLatin1String(" DateTime Property"));
item->setValue(QDateTime::currentDateTime());
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::KeySequence, QString::number(i++) + QLatin1String(" KeySequence Property"));
item->setValue(QKeySequence(Qt::ControlModifier | Qt::Key_Q));
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::Char, QString::number(i++) + QLatin1String(" Char Property"));
item->setValue(QChar());
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::Locale, QString::number(i++) + QLatin1String(" Locale Property"));
item->setValue(QLocale(QLocale::Polish, QLocale::Poland));
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::Point, QString::number(i++) + QLatin1String(" Point Property"));
item->setValue(QPoint(, ));
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::PointF, QString::number(i++) + QLatin1String(" PointF Property"));
item->setValue(QPointF(1.2345, -1.23451));
item->setAttribute(QLatin1String("decimals"), );
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::Size, QString::number(i++) + QLatin1String(" Size Property"));
item->setValue(QSize(, ));
item->setAttribute(QLatin1String("minimum"), QSize(, ));
item->setAttribute(QLatin1String("maximum"), QSize(, ));
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::SizeF, QString::number(i++) + QLatin1String(" SizeF Property"));
item->setValue(QSizeF(1.2345, 1.2345));
item->setAttribute(QLatin1String("decimals"), );
item->setAttribute(QLatin1String("minimum"), QSizeF(0.12, 0.34));
item->setAttribute(QLatin1String("maximum"), QSizeF(20.56, 20.78));
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::Rect, QString::number(i++) + QLatin1String(" Rect Property"));
item->setValue(QRect(, , , ));
topItem->addSubProperty(item);
item->setAttribute(QLatin1String("constraint"), QRect(, , , )); item = variantManager->addProperty(QVariant::RectF, QString::number(i++) + QLatin1String(" RectF Property"));
item->setValue(QRectF(1.2345, 1.2345, 1.2345, 1.2345));
topItem->addSubProperty(item);
item->setAttribute(QLatin1String("constraint"), QRectF(, , , ));
item->setAttribute(QLatin1String("decimals"), ); item = variantManager->addProperty(QtVariantPropertyManager::enumTypeId(),
QString::number(i++) + QLatin1String(" Enum Property"));
QStringList enumNames;
enumNames << "Enum0" << "Enum1" << "Enum2";
item->setAttribute(QLatin1String("enumNames"), enumNames);
item->setValue();
topItem->addSubProperty(item); item = variantManager->addProperty(QtVariantPropertyManager::flagTypeId(),
QString::number(i++) + QLatin1String(" Flag Property"));
QStringList flagNames;
flagNames << "Flag0" << "Flag1" << "Flag2";
item->setAttribute(QLatin1String("flagNames"), flagNames);
item->setValue();
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::SizePolicy, QString::number(i++) + QLatin1String(" SizePolicy Property"));
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::Font, QString::number(i++) + QLatin1String(" Font Property"));
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::Cursor, QString::number(i++) + QLatin1String(" Cursor Property"));
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::Color, QString::number(i++) + QLatin1String(" Color Property"));
topItem->addSubProperty(item); variantFactory = new QtVariantEditorFactory(); variantEditor = new QtTreePropertyBrowser();
variantEditor->setFactoryForManager(variantManager, variantFactory);
variantEditor->addProperty(topItem);
variantEditor->setPropertiesWithoutValueMarked(true);
variantEditor->setRootIsDecorated(false); setWidget(variantEditor); //variantEditor->show(); } void NodePropertyWidget::createArrowTreeProperty(){ variantManager = new QtVariantPropertyManager(); int i = ;
topItem = variantManager->addProperty(QtVariantPropertyManager::groupTypeId(),
QString::number(i++) + QLatin1String("Arrow Property")); item = variantManager->addProperty(QVariant::Bool, QString::number(i++) + QLatin1String(" Bool Property"));
item->setValue(true);
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::Int, QString::number(i++) + QLatin1String(" Int Property"));
item->setValue();
item->setAttribute(QLatin1String("minimum"), );
item->setAttribute(QLatin1String("maximum"), );
item->setAttribute(QLatin1String("singleStep"), );
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::Int, QString::number(i++) + QLatin1String(" Int Property (ReadOnly)"));
item->setValue();
item->setAttribute(QLatin1String("minimum"), );
item->setAttribute(QLatin1String("maximum"), );
item->setAttribute(QLatin1String("singleStep"), );
item->setAttribute(QLatin1String("readOnly"), true);
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::Double, QString::number(i++) + QLatin1String(" Double Property"));
item->setValue(1.2345);
item->setAttribute(QLatin1String("singleStep"), 0.1);
item->setAttribute(QLatin1String("decimals"), );
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::Double, QString::number(i++) + QLatin1String(" Double Property (ReadOnly)"));
item->setValue(1.23456);
item->setAttribute(QLatin1String("singleStep"), 0.1);
item->setAttribute(QLatin1String("decimals"), );
item->setAttribute(QLatin1String("readOnly"), true);
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::String, QString::number(i++) + QLatin1String(" String Property"));
item->setValue("Value");
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::String, QString::number(i++) + QLatin1String(" String Property (Password)"));
item->setAttribute(QLatin1String("echoMode"), QLineEdit::Password);
item->setValue("Password");
topItem->addSubProperty(item); // Readonly String Property
item = variantManager->addProperty(QVariant::String, QString::number(i++) + QLatin1String(" String Property (ReadOnly)"));
item->setAttribute(QLatin1String("readOnly"), true);
item->setValue("readonly text");
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::Date, QString::number(i++) + QLatin1String(" Date Property"));
item->setValue(QDate::currentDate().addDays());
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::Time, QString::number(i++) + QLatin1String(" Time Property"));
item->setValue(QTime::currentTime());
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::DateTime, QString::number(i++) + QLatin1String(" DateTime Property"));
item->setValue(QDateTime::currentDateTime());
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::KeySequence, QString::number(i++) + QLatin1String(" KeySequence Property"));
item->setValue(QKeySequence(Qt::ControlModifier | Qt::Key_Q));
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::Char, QString::number(i++) + QLatin1String(" Char Property"));
item->setValue(QChar());
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::Locale, QString::number(i++) + QLatin1String(" Locale Property"));
item->setValue(QLocale(QLocale::Polish, QLocale::Poland));
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::Point, QString::number(i++) + QLatin1String(" Point Property"));
item->setValue(QPoint(, ));
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::PointF, QString::number(i++) + QLatin1String(" PointF Property"));
item->setValue(QPointF(1.2345, -1.23451));
item->setAttribute(QLatin1String("decimals"), );
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::Size, QString::number(i++) + QLatin1String(" Size Property"));
item->setValue(QSize(, ));
item->setAttribute(QLatin1String("minimum"), QSize(, ));
item->setAttribute(QLatin1String("maximum"), QSize(, ));
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::SizeF, QString::number(i++) + QLatin1String(" SizeF Property"));
item->setValue(QSizeF(1.2345, 1.2345));
item->setAttribute(QLatin1String("decimals"), );
item->setAttribute(QLatin1String("minimum"), QSizeF(0.12, 0.34));
item->setAttribute(QLatin1String("maximum"), QSizeF(20.56, 20.78));
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::Rect, QString::number(i++) + QLatin1String(" Rect Property"));
item->setValue(QRect(, , , ));
topItem->addSubProperty(item);
item->setAttribute(QLatin1String("constraint"), QRect(, , , )); item = variantManager->addProperty(QVariant::RectF, QString::number(i++) + QLatin1String(" RectF Property"));
item->setValue(QRectF(1.2345, 1.2345, 1.2345, 1.2345));
topItem->addSubProperty(item);
item->setAttribute(QLatin1String("constraint"), QRectF(, , , ));
item->setAttribute(QLatin1String("decimals"), ); item = variantManager->addProperty(QtVariantPropertyManager::enumTypeId(),
QString::number(i++) + QLatin1String(" Enum Property"));
QStringList enumNames;
enumNames << "Enum0" << "Enum1" << "Enum2";
item->setAttribute(QLatin1String("enumNames"), enumNames);
item->setValue();
topItem->addSubProperty(item); item = variantManager->addProperty(QtVariantPropertyManager::flagTypeId(),
QString::number(i++) + QLatin1String(" Flag Property"));
QStringList flagNames;
flagNames << "Flag0" << "Flag1" << "Flag2";
item->setAttribute(QLatin1String("flagNames"), flagNames);
item->setValue();
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::SizePolicy, QString::number(i++) + QLatin1String(" SizePolicy Property"));
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::Font, QString::number(i++) + QLatin1String(" Font Property"));
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::Cursor, QString::number(i++) + QLatin1String(" Cursor Property"));
topItem->addSubProperty(item); item = variantManager->addProperty(QVariant::Color, QString::number(i++) + QLatin1String(" Color Property"));
topItem->addSubProperty(item); variantFactory = new QtVariantEditorFactory(); variantEditor = new QtTreePropertyBrowser();
variantEditor->setFactoryForManager(variantManager, variantFactory);
variantEditor->addProperty(topItem);
variantEditor->setPropertiesWithoutValueMarked(true);
variantEditor->setRootIsDecorated(false); setWidget(variantEditor);
//variantEditor->show(); }
以下的参考中还会给出很多propertybrowser的很多例子
references:
https://github.com/commontk/QtPropertyBrowser
Qt编程之实现属性窗口编辑器的更多相关文章
- Qt编程—去掉标题栏和设置窗口透明用法
学习Qt编程,有时候我们很想做出好看又比较炫的画面,这时就常用到qt上的一些技巧. 这里我以一个小例子来展示qt的这些技巧,此qt编程写的,如图:(去掉标题栏和设置窗口透明后) 代码实现部分: .h文 ...
- 零基础学QT编程
吴迪.2010.1 北京航空航天大学出版社 Qt资源 CSDN QT http://bbs.csdn.net/forums/Qt/ QT编程网 http://www.qtbcw.com/ 编程论坛 ...
- Qt编程之信号与槽-------unresolved external symbol "public: virtual struct QMetaObject const * __thiscall XX::metaObject(void)const
原因是加入Q_OBJECT这个macro的类,被编译的时候就要用到moc这个命令,所以在VS2010中,没有加入此命令的应用,当然会出错了.所以解决办法是加,或者如果你不使用信号槽可以直接删除. 当要 ...
- Qt编程之悲惨世界
最近需要给人写点基于QtWebkit的代码,算是领教了Qt编程的痛苦之处. QNetworkConfigurationManager::isOnline() 只有在编译平台上能运行,拷贝到其他Wind ...
- Qt编程简介与基本知识
1. 什么是Qt? Qt是一个基于C++的跨平台应用程序和UI开发框架.它包含一个类库,和用于跨平台开发及国际化的工具. 由挪威Trolltech公司开发,后被Nokia收购,目前被Digia公司收购 ...
- Qt编写控件属性设计器
一.前言 自从研究Qt编写自定义控件以来,一发不可收拾,越多越多人有类似的需求找我定制控件,陆陆续续写了上百个控件,目前已超过150个,于是逐渐衍生了另外一个需求,提供一个控件属性设计器,类似QtDe ...
- 73 QT编程入门
0 引言 最近开始在QT下编程,记录一下遇到的问题以及解决方法. 1 安装下载及学习资料 (1)安装下载链接 安装链接: https://blog.csdn.net/qq_23473839/artic ...
- qt编程入门
面对qt编程,必须先知道qt中常用的类: QPushButton按钮类.QLabel标签类.QMessageBox对话框类.QCheckBox.QAction.QMenu.QStatusBar.QTo ...
- qt如何实现一个渐隐窗口呢(开启的时候他是从上往下渐渐显示)
qt如何实现一个渐隐窗口呢?就是比如说开启的时候他是从上往下渐渐显示的,关闭的时候从下往上渐渐小时的http://stackoverflow.com/questions/19087822/how-to ...
随机推荐
- 求一个数组中第K小的数
面试南大夏令营的同学说被问到了这个问题,我的第一反应是建小顶堆,但是据他说用的是快排的方法说是O(n)的时间复杂度, 但是后来经过我的考证,这个算法在最坏的情况下是O(n^2)的,但是使用堆在一般情况 ...
- P - Atlantis - hdu1542(求面积)
题意:rt 求面积......不计算重复面积(废话..)hdu1255 的弱化版,应该先做这道题在做那道题的. ******************************************** ...
- JS-Array数组内置对象
直接上代码: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <ti ...
- 《Effective C++ 》学习笔记——条款11
***************************************转载请注明出处:http://blog.csdn.net/lttree************************** ...
- [Angular 2] *ngFor with index
Let's see how to track index when we use 'ngFor: <li *ngFor="#hero of heros | async, #i = in ...
- POJ 2455Secret Milking Machine(二分+网络流之最大流)
题目地址:POJ2455 手残真浪费时间啊..又拖到了今天才找出了错误..每晚两道题不知不觉又变回了每晚一道题...sad.. 第一次在isap中忘记调用bfs,第二次则是遍历的时候竟然是从1開始遍历 ...
- void*指针
C++提供了一种特殊的指针类型void*,它可以保存任何类型对象的地址: void*表明该指针与一地址值相关,但不清楚存储在此地址上的对象的类型. void*指针只支持几种有限的操作: 1)与另一个指 ...
- C#文件的拆分与合并操作示例
C#文件的拆分与合并操作示例代码. 全局变量定义 ;//文件大小 //拆分.合并的文件数 int count; FileInfo splitFile; string splitFliePath; Fi ...
- samba服务简介
1.1 Samba 概述Samba主要用于Windows和Linux之间的文件共享,也一样用于Linux和Linux之间的共享文件:不过对于Linux和Linux之间共享文件有更好的网络文件系统NFS ...
- 打开新窗口(window.open)
open() 方法可以查找一个已经存在或者新建的浏览器窗口. 语法: window.open([URL], [窗口名称], [参数字符串]) 参数说明: URL:可选参数,在窗口中要显示网页的网址或路 ...