修正大量demo
This commit is contained in:
@@ -86,14 +86,14 @@ ColorWidget::ColorWidget(QWidget *parent) : QWidget(parent)
|
||||
txtPoint = new QLineEdit(this);
|
||||
gridLayout->addWidget(txtPoint, 2, 2, 1, 1);
|
||||
|
||||
label->setText("当前颜色显示");
|
||||
label->setText("当前颜色");
|
||||
labWeb->setText("web值:");
|
||||
labRgb->setText("rgb值:");
|
||||
labPoint->setText("坐标值:");
|
||||
|
||||
this->setLayout(gridLayout);
|
||||
this->setWindowTitle("屏幕拾色器");
|
||||
this->setFixedSize(270, 108);
|
||||
this->setFixedSize(300, 108);
|
||||
|
||||
cp = QApplication::clipboard();
|
||||
pressed = false;
|
||||
|
||||
@@ -19,7 +19,7 @@ class ColorWidget : public QWidget
|
||||
public:
|
||||
static ColorWidget *Instance();
|
||||
explicit ColorWidget(QWidget *parent = 0);
|
||||
~ColorWidget();
|
||||
~ColorWidget();
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *);
|
||||
|
||||
@@ -14,5 +14,10 @@ DESTDIR = $$PWD/../bin
|
||||
CONFIG += warn_off
|
||||
|
||||
SOURCES += main.cpp
|
||||
SOURCES += frmcolorwidget.cpp
|
||||
SOURCES += colorwidget.cpp
|
||||
|
||||
HEADERS += colorwidget.h
|
||||
HEADERS += frmcolorwidget.h
|
||||
|
||||
FORMS += frmcolorwidget.ui
|
||||
|
||||
18
colorwidget/frmcolorwidget.cpp
Normal file
18
colorwidget/frmcolorwidget.cpp
Normal file
@@ -0,0 +1,18 @@
|
||||
#include "frmcolorwidget.h"
|
||||
#include "ui_frmcolorwidget.h"
|
||||
#include "colorwidget.h"
|
||||
|
||||
frmColorWidget::frmColorWidget(QWidget *parent) : QWidget(parent), ui(new Ui::frmColorWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
frmColorWidget::~frmColorWidget()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void frmColorWidget::on_pushButton_clicked()
|
||||
{
|
||||
ColorWidget::Instance()->show();
|
||||
}
|
||||
25
colorwidget/frmcolorwidget.h
Normal file
25
colorwidget/frmcolorwidget.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef FRMCOLORWIDGET_H
|
||||
#define FRMCOLORWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class frmColorWidget;
|
||||
}
|
||||
|
||||
class frmColorWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit frmColorWidget(QWidget *parent = 0);
|
||||
~frmColorWidget();
|
||||
|
||||
private slots:
|
||||
void on_pushButton_clicked();
|
||||
|
||||
private:
|
||||
Ui::frmColorWidget *ui;
|
||||
};
|
||||
|
||||
#endif // FRMCOLORWIDGET_H
|
||||
32
colorwidget/frmcolorwidget.ui
Normal file
32
colorwidget/frmcolorwidget.ui
Normal file
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>frmColorWidget</class>
|
||||
<widget class="QWidget" name="frmColorWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>92</width>
|
||||
<height>28</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>弹出</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -1,9 +1,8 @@
|
||||
#pragma execution_character_set("utf-8")
|
||||
|
||||
#include "colorwidget.h"
|
||||
#include "frmcolorwidget.h"
|
||||
#include <QApplication>
|
||||
#include <QTextCodec>
|
||||
#include <QIcon>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@@ -24,7 +23,9 @@ int main(int argc, char *argv[])
|
||||
QTextCodec::setCodecForLocale(codec);
|
||||
#endif
|
||||
|
||||
ColorWidget::Instance()->show();
|
||||
frmColorWidget w;
|
||||
w.setWindowTitle("屏幕拾色器");
|
||||
w.show();
|
||||
|
||||
return a.exec();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user