Qt
楼兰公子
这个作者很懒,什么都没留下…
展开
-
[libusb]qt +libusb-1.0(二)---枚举设备
/* * libusb example program to list devices on the bus * Copyright © 2007 Daniel Drake <[email protected]> * * This library is free software; you can redistribute it and/or * modify it under ...原创 2020-04-06 21:13:48 · 747 阅读 · 0 评论 -
[libusb]qt +libusb-1.0(一)---开发配置
INCLUDEPATH += /home/xxxx/dev/tools/3rd/libusb/include/libusb-1.0LIBS +=-L /home/xxxx/dev/tools/3rd/libusb/lib \ -lusb-1.0 -lpthread原创 2020-04-06 21:15:10 · 807 阅读 · 0 评论 -
QT+Opencv 时报错Failed to load module “canberra-gtk-module“
解决方案sudo apt-get install libcanberra-gtk-module原创 2022-05-30 11:30:48 · 202 阅读 · 0 评论 -
qt aarch64(arm64) cross compile
#!/bin/sh../configure \-prefix /home/ubtech/dev/tools/qt/5.15.2/aarch64 \-confirm-license \-opensource \-release \-make libs \-xplatform linux-aarch64-gnu-g++ \-pch \-qt-libjpeg \-qt-libpng \-qt-zlib \-no-opengl \-no-sse2 \-no-openssl \-no-.原创 2022-01-07 15:43:50 · 668 阅读 · 1 评论 -
Qt 5.12.6 交叉编译在raspberry 3B上运行的配置
1.交叉编译Qt库2.配置Qt的交叉编译环境3.配置pro文件的安装路径target.path = /home/pi/qt/$${TARGET} #$$[QT_INSTALL_EXAMPLES]/charts/chartthemesINSTALLS += target4.配置qt的ssh路径配置5.raspberry中环境配置如下export QTEDIR=/home/pi/qt5export LD_LIBRARY_PATH=$QTEDIR/lib:$LD_LIBRA.原创 2021-09-11 17:14:28 · 196 阅读 · 1 评论 -
[boost]boost在qt中的引用配置
INCLUDEPATH += /usr/include/boostLIBS += -L/usr/lib/x86_64-linux-gnu/ -lboost_atomic \ -lboost_chrono \ -lboost_container \ -lboost_context \ ..原创 2020-12-07 11:43:45 · 296 阅读 · 0 评论 -
[VTK]VTK CmakeList配置GUI支持时候的路径
原创 2020-11-28 13:16:21 · 283 阅读 · 0 评论 -
[qml]QListView样式
QListView::item:selected { border: 1px solid #6a6ea9;}QListView::item:selected:!active { background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ABAFE5, stop: 1 #8588B2);}QListView::item:selected:a.原创 2020-11-25 10:25:11 · 635 阅读 · 0 评论 -
[qss]QListWidget
//my.qssQListWidget{ border:1px solid gray; /*边界线:宽度、颜色*/ /*background:gray;*/ /*表格背景色*/ color:black; /*前景色:文字颜色*/ /*margin:5px,5px,0px,50px;*/ /*上、下、左、右,间距*/}/*QListWidget::item{ padding-top:24px; padding-bott.原创 2020-11-25 10:21:24 · 478 阅读 · 0 评论 -
[qss]scroll 样式
//scroll.qss/*垂直滚动条整体*/QScrollBar:vertical{ width:8px; background:rgb(0,0,0,0%); margin:0px,0px,0px,0px; padding-top:12px; /*上预留位置*/ padding-bottom:12px; /*下预留位置*/}/*滚动条中滑块的样式*/QScrollBar::handle:vertical{ width:8px; .原创 2020-11-25 10:20:20 · 223 阅读 · 0 评论 -
[qss]QComboBox 式样
QComboBox { font-family: "Microsoft YaHei"; font-size: 14px; color: #BDC8E2; font-style: italic; font-weight: bold; padding-left: 30px; border-width: 1px; border-style: solid; border-color: aqua; background-color.原创 2020-11-24 21:44:42 · 154 阅读 · 0 评论 -
[qss]QDateEdit式样
QDateEdit{ background-color: white; border-style: solid; border-width: 4px; border-color: rgb(100,100,100); spacing: 5px; }QDateEdit::drop-down { image: url(:/new/myapp/cbarrowdn.png); width:50px; height:15px; subc.原创 2020-11-24 21:32:04 · 481 阅读 · 0 评论 -
[qss]QLCDNumber
void LcdNumber::Init(){ m_BottomLcdNumber = new QLCDNumber(this); m_TopLcdNumber = new QLCDNumber(this); m_TopLcdNumber->setAttribute(Qt::WA_TranslucentBackground, true); m_TopLcdNumber->setMode(QLCDNumber::Dec); m_TopLcdNumbe.原创 2020-11-24 21:07:49 · 456 阅读 · 0 评论 -
[qss]qslider
QSlider::groove:horizontal { border: 0px solid #bbb; } QSlider::sub-page:horizontal { background: rgb(235,97,0); border-radius: 0px; margin-top:8px; margin-bottom:8px; } QSlider::add-page:horizontal { background: rgb(255,255, 255); b.原创 2020-11-24 21:05:44 · 247 阅读 · 0 评论 -
[qss]QLineEdit
QLineEdit { /* 外边框 */ border:2px solid red; /* 倒角 */ border-radius: 10px; /* 内边框:上下和左右的距离*/ padding: 10 8px; /* 背景色 */ background: yellow; /* 选中高亮背色 */ selection-background-color:blue; min-width:200px; min-height:40px;}/* 密码模式 */Q.原创 2020-11-24 11:51:27 · 363 阅读 · 0 评论 -
[qml]spinBox的qss设置
QSpinBox { /* 为箭头保留空间 */ padding-right:20px; border:3px solid green; background:#FD5687; min-width:40px;}/* 向上按钮 */QSpinBox::up-button { subcontrol-origin:border; subcontrol-position:top right; width:16px; border-image:url(:/images/02.bmp); .原创 2020-11-24 11:27:38 · 754 阅读 · 0 评论 -
[QtCharts]Sunspots count
/******************************************************************************** Copyright (C) 2016 The Qt Company Ltd.** Contact: https://www.qt.io/licensing/**** This file is part of the Qt Charts module of the Qt Toolkit.**** $QT_BEGIN_LICENSE:.原创 2020-11-11 10:57:41 · 254 阅读 · 0 评论 -
[QtCharts]piechart
/******************************************************************************** Copyright (C) 2016 The Qt Company Ltd.** Contact: https://www.qt.io/licensing/**** This file is part of the Qt Charts module of the Qt Toolkit.**** $QT_BEGIN_LICENSE:.原创 2020-11-11 10:20:26 · 280 阅读 · 0 评论 -
[QtCharts]customchart
/******************************************************************************** Copyright (C) 2016 The Qt Company Ltd.** Contact: https://www.qt.io/licensing/**** This file is part of the Qt Charts module of the Qt Toolkit.**** $QT_BEGIN_LICENSE:.原创 2020-11-10 21:33:19 · 290 阅读 · 0 评论 -
[QtCharts]barchart
/******************************************************************************** Copyright (C) 2016 The Qt Company Ltd.** Contact: https://www.qt.io/licensing/**** This file is part of the Qt Charts module of the Qt Toolkit.**** $QT_BEGIN_LICENSE:.原创 2020-11-10 21:31:11 · 184 阅读 · 0 评论 -
2020-11-07
在槽函数里获取信号发射者1.前置条件是要知道发射至类型QSpinBox *spinBox = qobject_cast<QSPinBox*> (sender());原创 2020-11-07 19:13:57 · 103 阅读 · 0 评论 -
Qt自定义类的附加信息添加
class QMyClass : public QObject{ Q_OBJECT Q_CLASSINFO("author","Wang"); Q_CLASSINFO("company","UPC"); Q_CLASSINFO("version","3.0.1");public: ....}获取方式QMetaClassInfo QMetaObject::classInfo(int index) const原创 2020-11-07 18:16:13 · 254 阅读 · 0 评论 -
Qt 的PROPERTY定义属性
原创 2020-11-07 18:06:44 · 170 阅读 · 0 评论 -
Qt 应用程序设置图标
1.必须是ico结尾的图片2.在pro文件里添加入戏RC_ICONS = AppIcon.ico即可原创 2020-11-07 17:35:17 · 155 阅读 · 0 评论 -
Qt启动动画
QApplication app(argc,argv); QSplashScreen*splash=newQSplashScreen; splash->setPixmap(QPixmap(":/images/splash.png"));//设置图片 splash->show();//显示图片 Qt::Alignment topRight=Qt::AlignRight|Qt::AlignTop; splash->showM...原创 2020-11-05 15:35:59 · 95 阅读 · 0 评论 -
关闭QML调试器
方法在项目文件(.pro)添加 DEFINES+=QT_QML_DEBUG_NO_WARNING(只关闭打印输出,并不能关闭QML调试器)。 直接关闭QML调试器:Qt4版本: CONFIG -= declarative_debugQt5版本: CONFIG -= qml_debug原创 2020-11-04 12:52:32 · 517 阅读 · 0 评论 -
2020-10-10
mainwindow core code#include "mainwindow.h"#include "ui_mainwindow.h"#include<QTextCodec>MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow){ ui->setupUi(this); accessManager = new QNetw原创 2020-10-10 14:38:39 · 60 阅读 · 0 评论 -
qt sqlite create select
#include "mainwindow.h"#include <QApplication>#include <QApplication>#include<QSqlDatabase>#include<QSqlQuery>#include<QDebug>#include<QStringList>int main(int argc, char *argv[]){ QApplication a(argc, arg.原创 2020-10-10 10:48:23 · 300 阅读 · 0 评论 -
Qt support sql driver ubuntu 1804
#include "mainwindow.h"#include <QApplication>#include<QSqlDatabase>#include<QDebug>#include<QStringList>int main(int argc, char *argv[]){ QApplication a(argc, argv); //MainWindow w; //w.show(); qDebug()<&.原创 2020-10-10 10:24:08 · 130 阅读 · 0 评论 -
在Qt5中启用Qt4的方法
比如QHeadVew的setMovable,可以在pro或者pri文件中加上即可:DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0原创 2020-09-30 15:16:12 · 406 阅读 · 0 评论 -
全屏+QWebEngineView控件一起会产生右键菜单无法弹出的bug,需要上移一个像素
QRect rect = qApp->desktop()->geometry();rect.setY(-1);rect.setHeight(rect.height());this->setGeometry(rect);原创 2020-09-30 14:32:44 · 412 阅读 · 0 评论 -
3种贴图方式
最糟糕的贴图方式setPixmap,一般只用来简单的不是很频繁的贴图,频繁的建议painter绘制,默认双缓冲,高级点用opengl绘制,利用GPU。原创 2020-09-30 11:21:50 · 325 阅读 · 0 评论 -
窗体尺寸改变的时候不重绘窗体,则设置属性即可
setAttribute(Qt::WA_StaticContents, true);原创 2020-09-30 11:19:56 · 175 阅读 · 0 评论 -
程序中 默认获取焦点会有虚边框,可以去掉,设置样式
setStyleSheet("*{outline:0px;}");原创 2020-09-30 11:18:37 · 139 阅读 · 0 评论 -
大的项目嵌套很多子项目
会遇到子项目依赖其他子项目的时候,一部分子项目用来生成动态库,子项目依赖动态库进行编译,需子项目按顺序编译。TEMPLATE = subdirs#设置ordered参数以后会依次编译 demo designer examplesCONFIG += orderedSUBDIRS += demoSUBDIRS += designerSUBDIRS += examples...原创 2020-09-30 11:01:29 · 373 阅读 · 0 评论 -
焦点激活
在嵌入式linux上,如果设置了无边框窗体,而该窗体中又有文本框之类的,发现没法产生焦点进行输入,需要主动激活窗体。//这种方式设置的无边框窗体在嵌入式设备上无法产生焦点setWindowFlags(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint);w->show();w->activateWindow();//需要在show以后主动激活窗体...原创 2020-09-30 10:55:10 · 219 阅读 · 0 评论 -
QString replace
QString的replace函数会改变原字符串,切记,他在返回替换后的新字符串的同时也会改变原字符串原创 2020-09-30 10:51:28 · 4882 阅读 · 0 评论 -
Qt防止阻塞窗口影响其后代码执行
QDialog dialogdialog.setWindowModality(Qt::WindowModality);dailog.exec();//以上操作能够避免窗口后面的代码被阻塞原创 2020-09-29 21:05:29 · 1021 阅读 · 0 评论 -
Qt 默认不支持大资源,需要再pro文件开启资源开关
CONFIG += resources_big原创 2020-09-29 21:04:41 · 213 阅读 · 1 评论 -
Qt设置高分屏属性以便支持2K,4K高分辨率,尤其手机APP
写在main函数的#if(QT_VERSION >QT_VERSION_CHECK(5,6,0))QGuiApplication::setAttribute(Qt::AA_EnableHeightDpiScaling);QApplication a(argc,argv);前面原创 2020-09-29 20:45:36 · 822 阅读 · 0 评论