This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| typedef std::tuple<QString, QString, QString, QString, QString, | |
| QString, QString, QString, QString, QImage> | |
| PersonInfo; | |
| qRegisterMetaType<PersonInfo>("PersonInfo"); | |
| Q_DECLARE_METATYPE( Type) //使自定义类型可以存进QVarient | |
| This macro makes the type Type known to QMetaType as long as it provides a public default constructor, a public copy constructor and a public destructor. It is needed to use the type Type as a custom type in QVariant. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| https://msdn.microsoft.com/en-us/library/fsk896zz.aspx?f=255&MSPPError=-2147217396 | |
| How to: Debug a Release Build | |
| Visual Studio 2015 Other Versions | |
| You can debug a release build of an application. | |
| To debug a release build | |
| Open the Property Pages dialog box for the project. For details, see Working with Project Properties. | |
| Click the C/C++ node. Set Debug Information Format to C7 compatible (/Z7) or Program Database (/Zi). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| m_displayer->setPixmap(QPixmap::fromImage(image).scaled(m_displayer->size(), Qt::KeepAspectRatio)); | |
| //1、第一个参数应该为label的size,而不是图片的size | |
| //2、不应该设置setScaledContents(true); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 一个函数caller会在其内部调用另外一个函数callee,现在的情况是,caller可能会在多个地方被多次调用,而你希望callee只在第一次被调用时被调用一次。一般情况下,callee会是一个对环境或者资源的初始化工作。 | |
| 或许,从代码结构的角度来讲,你第一个想到的是把callee从caller中拿出来,放到某个合适的地方做初始化,这是个不错的方法,但相信我,在有些时候这并不是个有效的办法:你可能无法找个那个“合适的地方”,你也可能找到了但因此而失去lazy initialization的好处~~~。 | |
| 这里,我只想对这个问题找个好点的方法。 | |
| 第一个方法很简单,就是用个静态的flag来判断: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 基本理解 | |
| Q_DECLARE_METATYPE | |
| 如果要使自定义类型或其他非QMetaType内置类型在QVaiant中使用,必须使用该宏。 | |
| 该类型必须有公有的 构造、析构、复制构造 函数 | |
| qRegisterMetaType 必须使用该函数的两种情况 | |
| 如果非QMetaType内置类型要在 Qt 的属性系统中使用 | |
| 如果非QMetaType内置类型要在 queued 信号与槽 中使用 | |
| 二者关系 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 添加空白分割区域到 Dock | |
| defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}'; killall Dock | |
| 添加「最近使用」堆栈到 Dock | |
| defaults write com.apple.dock persistent-others -array-add '{"tile-data" = {"list-type" = 1;}; "tile-type" = "recents-tile";}'; killall Dock |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //解决办法,在object.h中头文件开始#undef slots 在最后#define slots | |
| #ifndef MAINWINDOW_H | |
| #define MAINWINDOW_H | |
| #pragma comment(lib,"C:/Python34/libs/python34.lib") | |
| #include <QtWidgets/QMainWindow> | |
| #include "ui_mainwindow.h" | |
| #include <QDebug> | |
| #include "C:\Python34\include\Python.h" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| qt程序中oracle数据库的sql语句中不能包含分号 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "mainwindow.h" | |
| #include <QApplication> | |
| #include <QtGui> | |
| #include <QtSql> | |
| int main(int argc, char **argv) | |
| { | |
| QApplication myApp(argc, argv); | |
| QLibrary *hello_lib = NULL; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "ItemFactory.h" | |
| #include <QDebug> | |
| ItemFactory *ItemFactory::instance = NULL; | |
| ItemFactory::ItemFactory(void) | |
| { | |
| } | |
| ItemFactory &ItemFactory::getInstance() |