1
git-svn-id: svn://db.shs.com.ru/libs@1 a8b55f48-bf90-11e4-a774-851b48703e85
126
qad_widgets/.kdev4/qad_widgets.kdev4
Normal file
@@ -0,0 +1,126 @@
|
||||
[Buildset]
|
||||
BuildItems=@Variant(\x00\x00\x00\t\x00\x00\x00\x00\x01\x00\x00\x00\x0b\x00\x00\x00\x00\x01\x00\x00\x00\x16\x00q\x00a\x00d\x00_\x00w\x00i\x00d\x00g\x00e\x00t\x00s)
|
||||
|
||||
[CMake]
|
||||
Build Directory Count=1
|
||||
Current Build Directory Index=0
|
||||
ProjectRootRelative=./
|
||||
|
||||
[CMake][CMake Build Directory 0]
|
||||
Build Directory Path=file:///mnt/data/orders/libs/qad_widgets/
|
||||
Build Type=
|
||||
CMake Binary=file:///usr/bin/cmake
|
||||
Environment Profile=
|
||||
Extra Arguments=
|
||||
Install Directory=file:///usr/local
|
||||
|
||||
[Defines And Includes][Compiler]
|
||||
Name=GCC
|
||||
Path=gcc
|
||||
Type=GCC
|
||||
|
||||
[Filters]
|
||||
size=20
|
||||
|
||||
[Filters][0]
|
||||
inclusive=0
|
||||
pattern=.*
|
||||
targets=3
|
||||
|
||||
[Filters][1]
|
||||
inclusive=0
|
||||
pattern=.git
|
||||
targets=2
|
||||
|
||||
[Filters][10]
|
||||
inclusive=0
|
||||
pattern=*.a
|
||||
targets=1
|
||||
|
||||
[Filters][11]
|
||||
inclusive=0
|
||||
pattern=*.so
|
||||
targets=1
|
||||
|
||||
[Filters][12]
|
||||
inclusive=0
|
||||
pattern=*.so.*
|
||||
targets=1
|
||||
|
||||
[Filters][13]
|
||||
inclusive=0
|
||||
pattern=moc_*
|
||||
targets=1
|
||||
|
||||
[Filters][14]
|
||||
inclusive=0
|
||||
pattern=*.moc
|
||||
targets=1
|
||||
|
||||
[Filters][15]
|
||||
inclusive=0
|
||||
pattern=ui_*
|
||||
targets=1
|
||||
|
||||
[Filters][16]
|
||||
inclusive=0
|
||||
pattern=qrc_*
|
||||
targets=1
|
||||
|
||||
[Filters][17]
|
||||
inclusive=0
|
||||
pattern=*~
|
||||
targets=1
|
||||
|
||||
[Filters][18]
|
||||
inclusive=0
|
||||
pattern=.*.kate-swp
|
||||
targets=1
|
||||
|
||||
[Filters][19]
|
||||
inclusive=0
|
||||
pattern=.*.swp
|
||||
targets=1
|
||||
|
||||
[Filters][2]
|
||||
inclusive=0
|
||||
pattern=CVS
|
||||
targets=2
|
||||
|
||||
[Filters][3]
|
||||
inclusive=0
|
||||
pattern=.svn
|
||||
targets=2
|
||||
|
||||
[Filters][4]
|
||||
inclusive=0
|
||||
pattern=_svn
|
||||
targets=2
|
||||
|
||||
[Filters][5]
|
||||
inclusive=0
|
||||
pattern=SCCS
|
||||
targets=2
|
||||
|
||||
[Filters][6]
|
||||
inclusive=0
|
||||
pattern=_darcs
|
||||
targets=2
|
||||
|
||||
[Filters][7]
|
||||
inclusive=0
|
||||
pattern=.hg
|
||||
targets=2
|
||||
|
||||
[Filters][8]
|
||||
inclusive=0
|
||||
pattern=.bzr
|
||||
targets=2
|
||||
|
||||
[Filters][9]
|
||||
inclusive=0
|
||||
pattern=*.o
|
||||
targets=1
|
||||
|
||||
[MakeBuilder]
|
||||
Number Of Jobs=8
|
||||
43
qad_widgets/CMakeLists.txt
Normal file
@@ -0,0 +1,43 @@
|
||||
project(qad_widgets)
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
find_package(Qt4 REQUIRED)
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${QT_INCLUDES})
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -Wall")
|
||||
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
|
||||
set(MOCS "qpiconsole.h" "spinslider.h"
|
||||
"colorbutton.h" "chardialog.h" "shortcuts.h"
|
||||
"qipedit.h" "clineedit.h" "ecombobox.h"
|
||||
"qpointedit.h" "qrectedit.h" "iconedlabel.h"
|
||||
"qcodeedit.h" "qvariantedit.h")
|
||||
set(CPPS "qpiconsole.cpp" "spinslider.cpp" "colorbutton.cpp"
|
||||
"chardialog.cpp" "shortcuts.cpp" "qipedit.cpp"
|
||||
"clineedit.cpp" "ecombobox.cpp" "qpointedit.cpp"
|
||||
"qrectedit.cpp" "qcodeedit.cpp" "qvariantedit.cpp")
|
||||
file(GLOB UIS "./*.ui")
|
||||
file(GLOB RES "./*.qrc")
|
||||
qt4_wrap_ui(CUIS ${UIS})
|
||||
qt4_wrap_cpp(CMOCS ${MOCS} OPTIONS -nw)
|
||||
qt4_add_resources(CRES ${RES})
|
||||
add_library(qad_widgets SHARED ${CPPS} ${CUIS} ${CMOCS} ${CRES})
|
||||
set(LIBS ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY})
|
||||
target_link_libraries(qad_widgets ${LIBS})
|
||||
if (DEFINED LIB)
|
||||
set(LIB 1)
|
||||
if (${WIN32})
|
||||
find_package(MinGW REQUIRED)
|
||||
set(CMAKE_INSTALL_PREFIX ${MINGW_DIR})
|
||||
install(FILES ${MOCS} DESTINATION ${MINGW_INCLUDE})
|
||||
install(TARGETS qad_widgets DESTINATION ${MINGW_LIB})
|
||||
get_filename_component(QTDIR ${QT_QMAKE_EXECUTABLE} PATH)
|
||||
install(TARGETS qad_widgets DESTINATION ${QTDIR})
|
||||
else ()
|
||||
set(CMAKE_INSTALL_PREFIX /usr)
|
||||
install(FILES ${MOCS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
|
||||
install(TARGETS qad_widgets DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
|
||||
endif ()
|
||||
else ()
|
||||
install(TARGETS qad_widgets DESTINATION bin)
|
||||
endif ()
|
||||
0
qad_widgets/LEDOS_devices.dat
Normal file
151
qad_widgets/chardialog.cpp
Normal file
@@ -0,0 +1,151 @@
|
||||
#include "chardialog.h"
|
||||
#include "ui_chardialog.h"
|
||||
|
||||
|
||||
CharDialog::CharDialog(QWidget * parent): QDialog(parent) {
|
||||
ui = new Ui::CharDialog();
|
||||
ui->setupUi(this);
|
||||
QChar c;
|
||||
int k;
|
||||
for (int i = 0; i < 256; ++i) {
|
||||
for (int j = 0; j < 256; ++j) {
|
||||
c = QChar(j, i);
|
||||
k = c.category();
|
||||
if (chars.size() <= k)
|
||||
chars.resize(k + 1);
|
||||
if (!c.isPrint()) continue;
|
||||
|
||||
chars[k].push_back(c);
|
||||
}
|
||||
}
|
||||
size = 30;
|
||||
QStringList cat;
|
||||
cat << tr("No Category") << tr("Mark NonSpacing") << tr("Mark SpacingCombining") << tr("Mark Enclosing")
|
||||
<< tr("Number DecimalDigit") << tr("Number Letter") << tr("Number Other") << tr("Separator Space")
|
||||
<< tr("Separator Line") << tr("Separator Paragraph") << tr("Other Control") << tr("Other Format")
|
||||
<< tr("Other Surrogate") << tr("Other PrivateUse") << tr("Other NotAssigned") << tr("Letter Uppercase")
|
||||
<< tr("Letter Lowercase") << tr("Letter Titlecase") << tr("Letter Modifier") << tr("Letter Other")
|
||||
<< tr("Punctuation Connector") << tr("Punctuation Dash") << tr("Punctuation Open") << tr("Punctuation Close")
|
||||
<< tr("Punctuation InitialQuote") << tr("Punctuation FinalQuote") << tr("Punctuation Other") << tr("Symbol Math")
|
||||
<< tr("Symbol Currency") << tr("Symbol Modifier") << tr("Symbol Other");
|
||||
ui->comboCategory->addItems(cat);
|
||||
ui->spinSize->setValue(size);
|
||||
ui->comboCategory->setCurrentIndex(27);
|
||||
ui->tableChars->viewport()->installEventFilter(this);
|
||||
}
|
||||
|
||||
|
||||
CharDialog::~CharDialog() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
||||
void CharDialog::setCharFont(const QFont & f) {
|
||||
QFont fnt = ui->tableChars->font();
|
||||
fnt.setFamily(f.family());
|
||||
ui->tableChars->setFont(fnt);
|
||||
}
|
||||
|
||||
|
||||
void CharDialog::changeEvent(QEvent * e) {
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
ui->retranslateUi(this);
|
||||
QStringList cat;
|
||||
cat << tr("No Category") << tr("Mark NonSpacing") << tr("Mark SpacingCombining") << tr("Mark Enclosing")
|
||||
<< tr("Number DecimalDigit") << tr("Number Letter") << tr("Number Other") << tr("Separator Space")
|
||||
<< tr("Separator Line") << tr("Separator Paragraph") << tr("Other Control") << tr("Other Format")
|
||||
<< tr("Other Surrogate") << tr("Other PrivateUse") << tr("Other NotAssigned") << tr("Letter Uppercase")
|
||||
<< tr("Letter Lowercase") << tr("Letter Titlecase") << tr("Letter Modifier") << tr("Letter Other")
|
||||
<< tr("Punctuation Connector") << tr("Punctuation Dash") << tr("Punctuation Open") << tr("Punctuation Close")
|
||||
<< tr("Punctuation InitialQuote") << tr("Punctuation FinalQuote") << tr("Punctuation Other") << tr("Symbol Math")
|
||||
<< tr("Symbol Currency") << tr("Symbol Modifier") << tr("Symbol Other");
|
||||
int pi = ui->comboCategory->currentIndex();
|
||||
ui->comboCategory->clear();
|
||||
ui->comboCategory->addItems(cat);
|
||||
ui->comboCategory->setCurrentIndex(pi);
|
||||
return;
|
||||
}
|
||||
QDialog::changeEvent(e);
|
||||
}
|
||||
|
||||
|
||||
bool CharDialog::eventFilter(QObject * o, QEvent * e) {
|
||||
if (o == ui->tableChars->viewport()) {
|
||||
if (e->type() != QEvent::Wheel)
|
||||
return QDialog::eventFilter(o, e);
|
||||
qApp->sendEvent(ui->verticalScroll, e);
|
||||
}
|
||||
return QDialog::eventFilter(o, e);
|
||||
}
|
||||
|
||||
|
||||
void CharDialog::resizeEvent(QResizeEvent * ) {
|
||||
int r = ui->tableChars->contentsRect().height() / csize, c = ui->tableChars->contentsRect().width() / csize;
|
||||
ui->tableChars->setRowCount(r);
|
||||
ui->tableChars->setColumnCount(c);
|
||||
for (int i = 0; i < r; ++i) {
|
||||
for (int j = 0; j < c; ++j) {
|
||||
if (ui->tableChars->item(i, j) == 0) {
|
||||
ui->tableChars->setItem(i, j, new QTableWidgetItem());
|
||||
ui->tableChars->item(i, j)->setTextAlignment(Qt::AlignCenter);
|
||||
}
|
||||
}
|
||||
}
|
||||
on_comboCategory_currentIndexChanged(ui->comboCategory->currentIndex());
|
||||
}
|
||||
|
||||
|
||||
void CharDialog::clear() {
|
||||
for (int i = 0; i < ui->tableChars->rowCount(); ++i)
|
||||
for (int j = 0; j < ui->tableChars->columnCount(); ++j)
|
||||
ui->tableChars->item(i, j)->setText(QString());
|
||||
}
|
||||
|
||||
|
||||
void CharDialog::on_comboCategory_currentIndexChanged(int index) {
|
||||
if (index < 0) return;
|
||||
int r = ui->tableChars->rowCount(), c = ui->tableChars->columnCount(), m;
|
||||
cur = &chars[index];
|
||||
if (r == 0) return;
|
||||
m = (cur->size() - 2) / c - r + 1;
|
||||
if (m < 0) m = 0;
|
||||
ui->verticalScroll->setMinimum(0);
|
||||
ui->verticalScroll->setMaximum(m);
|
||||
on_verticalScroll_valueChanged(ui->verticalScroll->value());
|
||||
}
|
||||
|
||||
|
||||
void CharDialog::on_verticalScroll_valueChanged(int index) {
|
||||
int ci = ui->tableChars->columnCount() * index;
|
||||
for (int i = 0; i < ui->tableChars->rowCount(); ++i) {
|
||||
for (int j = 0; j < ui->tableChars->columnCount(); ++j) {
|
||||
++ci;
|
||||
if (cur->size() > ci) ui->tableChars->item(i, j)->setText(cur->at(ci));
|
||||
else ui->tableChars->item(i, j)->setText(QString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CharDialog::on_spinSize_valueChanged(int index) {
|
||||
size = index;
|
||||
csize = size * 2;
|
||||
ui->tableChars->horizontalHeader()->setDefaultSectionSize(csize);
|
||||
ui->tableChars->verticalHeader()->setDefaultSectionSize(csize);
|
||||
on_comboCategory_currentIndexChanged(ui->comboCategory->currentIndex());
|
||||
QFont font = ui->tableChars->font();
|
||||
font.setPointSize(size);
|
||||
ui->tableChars->setFont(font);
|
||||
resizeEvent(0);
|
||||
}
|
||||
|
||||
|
||||
void CharDialog::on_tableChars_cellPressed(int row, int column) {
|
||||
sel_char = ui->tableChars->item(row, column)->text()[0];
|
||||
}
|
||||
|
||||
|
||||
void CharDialog::on_buttonBox_accepted() {
|
||||
emit charSelected(sel_char);
|
||||
accept();
|
||||
}
|
||||
50
qad_widgets/chardialog.h
Normal file
@@ -0,0 +1,50 @@
|
||||
#ifndef CHARDIALOG_H
|
||||
#define CHARDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QMetaEnum>
|
||||
#include <QDebug>
|
||||
|
||||
namespace Ui {
|
||||
class CharDialog;
|
||||
};
|
||||
|
||||
class CharDialog: public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CharDialog(QWidget * parent = 0);
|
||||
~CharDialog();
|
||||
|
||||
QChar selectedChar() {return sel_char;}
|
||||
void setCharFont(const QFont & f);
|
||||
|
||||
public slots:
|
||||
|
||||
private:
|
||||
void changeEvent(QEvent * e);
|
||||
virtual bool eventFilter(QObject * o, QEvent * e);
|
||||
virtual void resizeEvent(QResizeEvent * );
|
||||
void clear();
|
||||
|
||||
Ui::CharDialog * ui;
|
||||
QVector<QVector<QChar> > chars;
|
||||
QVector<QChar> * cur;
|
||||
QChar sel_char;
|
||||
int size, csize;
|
||||
|
||||
private slots:
|
||||
void on_comboCategory_currentIndexChanged(int index);
|
||||
void on_verticalScroll_valueChanged(int index);
|
||||
void on_spinSize_valueChanged(int index);
|
||||
void on_tableChars_cellPressed(int row, int column);
|
||||
void on_tableChars_cellDoubleClicked(int , int ) {on_buttonBox_accepted();}
|
||||
void on_buttonBox_accepted();
|
||||
void on_buttonBox_rejected() {reject();}
|
||||
|
||||
signals:
|
||||
void charSelected(QChar ch);
|
||||
|
||||
};
|
||||
|
||||
#endif // CHARDIALOG_H
|
||||
92
qad_widgets/chardialog.ui
Normal file
@@ -0,0 +1,92 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CharDialog</class>
|
||||
<widget class="QDialog" name="CharDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>467</width>
|
||||
<height>448</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Choose symbol</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="mbricks.qrc">
|
||||
<normaloff>:/icons/icons/mbricks_128.png</normaloff>:/icons/icons/mbricks_128.png</iconset>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="margin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QComboBox" name="comboCategory">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QTableWidget" name="tableChars">
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<attribute name="horizontalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="horizontalHeaderDefaultSectionSize">
|
||||
<number>24</number>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderDefaultSectionSize">
|
||||
<number>24</number>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QScrollBar" name="verticalScroll">
|
||||
<property name="maximum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" colspan="2">
|
||||
<widget class="QSpinBox" name="spinSize">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>200</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="3">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="mbricks.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
69
qad_widgets/chardialogplugin.cpp
Normal file
@@ -0,0 +1,69 @@
|
||||
#include "chardialog.h"
|
||||
#include "chardialogplugin.h"
|
||||
#include <QtCore/QtPlugin>
|
||||
|
||||
|
||||
CharDialogPlugin::CharDialogPlugin(QObject * parent): QObject(parent) {
|
||||
m_initialized = false;
|
||||
}
|
||||
|
||||
|
||||
void CharDialogPlugin::initialize(QDesignerFormEditorInterface * /* core */) {
|
||||
if (m_initialized)
|
||||
return;
|
||||
|
||||
// Add extension registrations, etc. here
|
||||
|
||||
m_initialized = true;
|
||||
}
|
||||
|
||||
|
||||
bool CharDialogPlugin::isInitialized() const {
|
||||
return m_initialized;
|
||||
}
|
||||
|
||||
|
||||
QWidget * CharDialogPlugin::createWidget(QWidget * parent) {
|
||||
return new CharDialog(parent);
|
||||
}
|
||||
|
||||
|
||||
QString CharDialogPlugin::name() const {
|
||||
return QLatin1String("CharDialog");
|
||||
}
|
||||
|
||||
|
||||
QString CharDialogPlugin::group() const {
|
||||
return QLatin1String("Dialogs");
|
||||
}
|
||||
|
||||
|
||||
QIcon CharDialogPlugin::icon() const {
|
||||
return QIcon(":/icons/chardialog.png");
|
||||
}
|
||||
|
||||
|
||||
QString CharDialogPlugin::toolTip() const {
|
||||
return QLatin1String("Character Select Dialog");
|
||||
}
|
||||
|
||||
|
||||
QString CharDialogPlugin::whatsThis() const {
|
||||
return QLatin1String("Character Select Dialog");
|
||||
}
|
||||
|
||||
|
||||
bool CharDialogPlugin::isContainer() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
QString CharDialogPlugin::domXml() const {
|
||||
return QLatin1String("<widget class=\"CharDialog\" name=\"charDialog\">\n</widget>\n");
|
||||
}
|
||||
|
||||
|
||||
QString CharDialogPlugin::includeFile() const {
|
||||
return QLatin1String("chardialog.h");
|
||||
}
|
||||
|
||||
31
qad_widgets/chardialogplugin.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef CHARDIALOGPLUGIN_H
|
||||
#define CHARDIALOGPLUGIN_H
|
||||
|
||||
#include <QDesignerCustomWidgetInterface>
|
||||
|
||||
class CharDialogPlugin: public QObject, public QDesignerCustomWidgetInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(QDesignerCustomWidgetInterface)
|
||||
|
||||
public:
|
||||
CharDialogPlugin(QObject * parent = 0);
|
||||
|
||||
bool isContainer() const;
|
||||
bool isInitialized() const;
|
||||
QIcon icon() const;
|
||||
QString domXml() const;
|
||||
QString group() const;
|
||||
QString includeFile() const;
|
||||
QString name() const;
|
||||
QString toolTip() const;
|
||||
QString whatsThis() const;
|
||||
QWidget * createWidget(QWidget * parent);
|
||||
void initialize(QDesignerFormEditorInterface * core);
|
||||
|
||||
private:
|
||||
bool m_initialized;
|
||||
|
||||
};
|
||||
|
||||
#endif // CHARDIALOGPLUGIN_H
|
||||
4
qad_widgets/clean
Normal file
@@ -0,0 +1,4 @@
|
||||
#! /bin/bash
|
||||
VERBOSE=1 make clean
|
||||
rm -rvf CMakeFiles
|
||||
rm -vf CMakeCache.txt Makefile cmake_install.cmake install_manifest.txt *.dll *.a *.so *.user* *~ *cxx moc_* ui_* qrc_* *.o *.bak
|
||||
4
qad_widgets/clean.bat
Normal file
@@ -0,0 +1,4 @@
|
||||
#make clean
|
||||
del /q /f /s CMakeFiles
|
||||
rmdir /q /s CMakeFiles
|
||||
del /q /f CMakeCache.txt Makefile cmake_install.cmake install_manifest.txt *.user* *~ *cxx moc_* ui_* qrc_* *.o *.exe *.a *.dll *.lib core *.bak
|
||||
51
qad_widgets/clineedit.cpp
Normal file
@@ -0,0 +1,51 @@
|
||||
#include "clineedit.h"
|
||||
|
||||
|
||||
CLineEdit::CLineEdit(QWidget * parent): QLineEdit(parent) {
|
||||
cw = new QWidget(this);
|
||||
cw->setStyleSheet("background-image: url(:/icons/edit-clear-locationbar-rtl.png);");
|
||||
cw->setCursor(Qt::ArrowCursor);
|
||||
cw->setToolTip(tr("Clear"));
|
||||
cw->hide();
|
||||
cw->installEventFilter(this);
|
||||
int m0, m1, m2, m3;
|
||||
getTextMargins(&m0, &m1, &m2, &m3);
|
||||
setTextMargins(m0, m1, m2 + 21, m3);
|
||||
connect(this, SIGNAL(textChanged(QString)), this, SLOT(textChanged_(QString)));
|
||||
//connect(cw, SIGNAL(mouseReleaseEvent(QMouseEvent * )), this, SLOT(clearMouseRelease(QMouseEvent * )));
|
||||
}
|
||||
|
||||
|
||||
bool CLineEdit::eventFilter(QObject * o, QEvent * e) {
|
||||
if (e->type() == QEvent::MouseButtonRelease) {
|
||||
clearMouseRelease((QMouseEvent * )e);
|
||||
}
|
||||
return QLineEdit::eventFilter(o, e);
|
||||
}
|
||||
|
||||
|
||||
void CLineEdit::resizeEvent(QResizeEvent * e) {
|
||||
QLineEdit::resizeEvent(e);
|
||||
cw->setGeometry(width() - 21, (height() - 17) / 2, 16, 16);
|
||||
}
|
||||
|
||||
|
||||
void CLineEdit::changeEvent(QEvent * e) {
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
cw->setToolTip(tr("Clear"));
|
||||
return;
|
||||
}
|
||||
QLineEdit::changeEvent(e);
|
||||
}
|
||||
|
||||
|
||||
void CLineEdit::setDefaultText(const QString & t, bool set_text) {
|
||||
dt = t;
|
||||
if (set_text) {
|
||||
setText(t);
|
||||
emit textEdited(t);
|
||||
cw->hide();
|
||||
return;
|
||||
}
|
||||
textChanged_(text());
|
||||
}
|
||||
43
qad_widgets/clineedit.h
Normal file
@@ -0,0 +1,43 @@
|
||||
#ifndef CLINEEDIT_H
|
||||
#define CLINEEDIT_H
|
||||
|
||||
#include <QDebug>
|
||||
#include <QLineEdit>
|
||||
#include <QMouseEvent>
|
||||
#include <QPainter>
|
||||
|
||||
|
||||
class CLineEdit: public QLineEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString defaultText READ defaultText WRITE setDefaultText)
|
||||
|
||||
public:
|
||||
explicit CLineEdit(QWidget * parent = 0);
|
||||
~CLineEdit() {delete cw;}
|
||||
|
||||
inline QString defaultText() const {return dt;}
|
||||
|
||||
protected:
|
||||
QWidget * cw;
|
||||
QString dt;
|
||||
|
||||
private:
|
||||
bool eventFilter(QObject * o, QEvent * e);
|
||||
void resizeEvent(QResizeEvent * );
|
||||
void changeEvent(QEvent * e);
|
||||
|
||||
private slots:
|
||||
void clearMouseRelease(QMouseEvent * e) {if (cw->rect().contains(e->pos())) clearClick();}
|
||||
void textChanged_(QString text) {cw->setVisible(text != dt);}
|
||||
|
||||
public slots:
|
||||
void clearClick() {if (!isEnabled()) return; setText(dt); emit cleared(); emit textEdited(dt);}
|
||||
void setDefaultText(const QString & t, bool set_text = false);
|
||||
|
||||
signals:
|
||||
void cleared();
|
||||
|
||||
};
|
||||
|
||||
#endif // CLINEEDIT_H
|
||||
69
qad_widgets/clineeditplugin.cpp
Normal file
@@ -0,0 +1,69 @@
|
||||
#include "clineedit.h"
|
||||
#include "clineeditplugin.h"
|
||||
#include <QtCore/QtPlugin>
|
||||
|
||||
|
||||
CLineEditPlugin::CLineEditPlugin(QObject * parent): QObject(parent) {
|
||||
m_initialized = false;
|
||||
}
|
||||
|
||||
|
||||
void CLineEditPlugin::initialize(QDesignerFormEditorInterface * /* core */) {
|
||||
if (m_initialized)
|
||||
return;
|
||||
|
||||
// Add extension registrations, etc. here
|
||||
|
||||
m_initialized = true;
|
||||
}
|
||||
|
||||
|
||||
bool CLineEditPlugin::isInitialized() const {
|
||||
return m_initialized;
|
||||
}
|
||||
|
||||
|
||||
QWidget * CLineEditPlugin::createWidget(QWidget * parent) {
|
||||
return new CLineEdit(parent);
|
||||
}
|
||||
|
||||
|
||||
QString CLineEditPlugin::name() const {
|
||||
return QLatin1String("CLineEdit");
|
||||
}
|
||||
|
||||
|
||||
QString CLineEditPlugin::group() const {
|
||||
return QLatin1String("Input Widgets");
|
||||
}
|
||||
|
||||
|
||||
QIcon CLineEditPlugin::icon() const {
|
||||
return QIcon(":/icons/clineedit.png");
|
||||
}
|
||||
|
||||
|
||||
QString CLineEditPlugin::toolTip() const {
|
||||
return QLatin1String("Clearable Line Edit");
|
||||
}
|
||||
|
||||
|
||||
QString CLineEditPlugin::whatsThis() const {
|
||||
return QLatin1String("Clearable Line Edit");
|
||||
}
|
||||
|
||||
|
||||
bool CLineEditPlugin::isContainer() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
QString CLineEditPlugin::domXml() const {
|
||||
return QLatin1String("<widget class=\"CLineEdit\" name=\"lineEdit\">\n</widget>\n");
|
||||
}
|
||||
|
||||
|
||||
QString CLineEditPlugin::includeFile() const {
|
||||
return QLatin1String("clineedit.h");
|
||||
}
|
||||
|
||||
31
qad_widgets/clineeditplugin.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef CLINEEDITPLUGIN_H
|
||||
#define CLINEEDITPLUGIN_H
|
||||
|
||||
#include <QDesignerCustomWidgetInterface>
|
||||
|
||||
class CLineEditPlugin: public QObject, public QDesignerCustomWidgetInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(QDesignerCustomWidgetInterface)
|
||||
|
||||
public:
|
||||
CLineEditPlugin(QObject * parent = 0);
|
||||
|
||||
bool isContainer() const;
|
||||
bool isInitialized() const;
|
||||
QIcon icon() const;
|
||||
QString domXml() const;
|
||||
QString group() const;
|
||||
QString includeFile() const;
|
||||
QString name() const;
|
||||
QString toolTip() const;
|
||||
QString whatsThis() const;
|
||||
QWidget * createWidget(QWidget * parent);
|
||||
void initialize(QDesignerFormEditorInterface * core);
|
||||
|
||||
private:
|
||||
bool m_initialized;
|
||||
|
||||
};
|
||||
|
||||
#endif // CLINEEDITPLUGIN_H
|
||||
112
qad_widgets/colorbutton.cpp
Normal file
@@ -0,0 +1,112 @@
|
||||
#include "colorbutton.h"
|
||||
#include <QDebug>
|
||||
#include <QDrag>
|
||||
#include <QMimeData>
|
||||
|
||||
ColorButton::ColorButton(QWidget * parent): QPushButton(parent) {
|
||||
frame = false;
|
||||
options = QColorDialog::ShowAlphaChannel;
|
||||
back = new QWidget(this);
|
||||
back->setAutoFillBackground(true);
|
||||
back->show();
|
||||
pal = back->palette();
|
||||
pal.setBrush(back->backgroundRole(), QBrush(QImage(":/icons/alpha.png")));
|
||||
back->setPalette(pal);
|
||||
label = new QFrame(this);
|
||||
label->setAutoFillBackground(true);
|
||||
label->setFrameStyle(QFrame::Panel | QFrame::Sunken);
|
||||
label->show();
|
||||
pal = label->palette();
|
||||
menu.addAction(QIcon(":/icons/edit-copy.png"), tr("Copy"), this, SLOT(copy()));
|
||||
menu.addAction(QIcon(":/icons/edit-paste.png"), tr("Paste"), this, SLOT(paste()));
|
||||
menu.addSeparator();
|
||||
menu.addAction(tr("Mix with clipboard"), this, SLOT(mix()));
|
||||
setAcceptDrops(true);
|
||||
connect(this, SIGNAL(clicked(bool)), this, SLOT(clicked()));
|
||||
}
|
||||
|
||||
|
||||
ColorButton::~ColorButton() {
|
||||
delete label;
|
||||
}
|
||||
|
||||
|
||||
void ColorButton::resizeEvent(QResizeEvent * ) {
|
||||
if (frame) back->setGeometry(rect());
|
||||
else back->setGeometry(8, 5, width() - 16, height() - 12);
|
||||
label->setGeometry(back->geometry());
|
||||
}
|
||||
|
||||
|
||||
void ColorButton::mousePressEvent(QMouseEvent * e) {
|
||||
pp = e->pos();
|
||||
if (e->buttons().testFlag(Qt::RightButton)) {
|
||||
menu.popup(e->globalPos());
|
||||
return;
|
||||
}
|
||||
QPushButton::mousePressEvent(e);
|
||||
}
|
||||
|
||||
|
||||
void ColorButton::mouseMoveEvent(QMouseEvent * e) {
|
||||
if (e->buttons().testFlag(Qt::LeftButton)) {
|
||||
if ((e->pos() - pp).manhattanLength() > QApplication::startDragDistance()) {
|
||||
setDown(false);
|
||||
QDrag * drag = new QDrag(this);
|
||||
QMimeData * data = new QMimeData();
|
||||
data->setColorData(color());
|
||||
drag->setMimeData(data);
|
||||
drag->exec(Qt::CopyAction);
|
||||
return;
|
||||
}
|
||||
}
|
||||
QPushButton::mouseMoveEvent(e);
|
||||
}
|
||||
|
||||
|
||||
void ColorButton::dragEnterEvent(QDragEnterEvent * e) {
|
||||
e->accept();
|
||||
QPushButton::dragEnterEvent(e);
|
||||
}
|
||||
|
||||
|
||||
void ColorButton::dropEvent(QDropEvent * e) {
|
||||
const QMimeData * data = e->mimeData();
|
||||
QColor c = qvariant_cast<QColor>(data->colorData());
|
||||
if (c.isValid()) {
|
||||
setColor(c);
|
||||
return;
|
||||
}
|
||||
c = QColor(data->text());
|
||||
if (c.isValid()) {
|
||||
setColor(c);
|
||||
return;
|
||||
}
|
||||
QPushButton::dropEvent(e);
|
||||
}
|
||||
|
||||
|
||||
void ColorButton::clicked() {
|
||||
QColor ret = QColorDialog::getColor(color(), this, tr("Choose color"), options);
|
||||
if (!ret.isValid()) return;
|
||||
setColor(ret);
|
||||
}
|
||||
|
||||
|
||||
void ColorButton::mix() {
|
||||
QColor c(QApplication::clipboard()->text());
|
||||
if (!c.isValid()) return;
|
||||
QColor sc = color();
|
||||
setColor(QColor((c.red() + sc.red()) / 2, (c.green() + sc.green()) / 2, (c.blue() + sc.blue()) / 2, (c.alpha() + sc.alpha()) / 2));
|
||||
}
|
||||
|
||||
|
||||
void ColorButton::setColor(const QColor & col) {
|
||||
if (pal.color(label->backgroundRole()) == col) return;
|
||||
if (options.testFlag(QColorDialog::ShowAlphaChannel))
|
||||
pal.setColor(label->backgroundRole(), col);
|
||||
else
|
||||
pal.setColor(label->backgroundRole(), QColor(col.red(), col.green(), col.blue()));
|
||||
label->setPalette(pal);
|
||||
emit colorChanged(color());
|
||||
}
|
||||
63
qad_widgets/colorbutton.h
Normal file
@@ -0,0 +1,63 @@
|
||||
#ifndef COLORBUTTON_H
|
||||
#define COLORBUTTON_H
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QFrame>
|
||||
#include <QColorDialog>
|
||||
#include <QMouseEvent>
|
||||
#include <QAction>
|
||||
#include <QMenu>
|
||||
#include <QClipboard>
|
||||
#include <QApplication>
|
||||
|
||||
|
||||
class ColorButton: public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QColor color READ color WRITE setColor)
|
||||
Q_PROPERTY(bool useNativeDialog READ useNativeDialog WRITE setUseNativeDialog)
|
||||
Q_PROPERTY(bool useAlphaChannel READ useAlphaChannel WRITE setUseAlphaChannel)
|
||||
Q_PROPERTY(bool frameOnly READ frameOnly WRITE setFrameOnly)
|
||||
|
||||
public:
|
||||
explicit ColorButton(QWidget * parent = 0);
|
||||
~ColorButton();
|
||||
|
||||
QColor color() const {return pal.color(label->backgroundRole());}
|
||||
bool useNativeDialog() const {return !options.testFlag(QColorDialog::DontUseNativeDialog);}
|
||||
bool useAlphaChannel() const {return options.testFlag(QColorDialog::ShowAlphaChannel);}
|
||||
bool frameOnly() const {return frame;}
|
||||
|
||||
public slots:
|
||||
void setColor(const QColor & col);
|
||||
void setUseNativeDialog(bool yes) {if (yes) options &= ~QColorDialog::DontUseNativeDialog; else options |= QColorDialog::DontUseNativeDialog;}
|
||||
void setUseAlphaChannel(bool yes) {if (yes) options |= QColorDialog::ShowAlphaChannel; else options &= ~QColorDialog::ShowAlphaChannel;}
|
||||
void setFrameOnly(bool yes) {frame = yes; setFlat(frame); resizeEvent(0);}
|
||||
|
||||
private:
|
||||
void mousePressEvent(QMouseEvent * e);
|
||||
void mouseMoveEvent(QMouseEvent * e);
|
||||
void resizeEvent(QResizeEvent * );
|
||||
void dragEnterEvent(QDragEnterEvent * e);
|
||||
void dropEvent(QDropEvent * e);
|
||||
|
||||
QFrame * label;
|
||||
QWidget * back;
|
||||
QPalette pal;
|
||||
QPoint pp;
|
||||
QMenu menu;
|
||||
QColorDialog::ColorDialogOptions options;
|
||||
bool frame;
|
||||
|
||||
private slots:
|
||||
void clicked();
|
||||
void copy() {QApplication::clipboard()->setText(color().name());}
|
||||
void paste() {QColor c(QApplication::clipboard()->text()); if (c.isValid()) setColor(c);}
|
||||
void mix();
|
||||
|
||||
signals:
|
||||
void colorChanged(QColor);
|
||||
|
||||
};
|
||||
|
||||
#endif // COLORBUTTON_H
|
||||
69
qad_widgets/colorbuttonplugin.cpp
Normal file
@@ -0,0 +1,69 @@
|
||||
#include "colorbutton.h"
|
||||
#include "colorbuttonplugin.h"
|
||||
#include <QtCore/QtPlugin>
|
||||
|
||||
|
||||
ColorButtonPlugin::ColorButtonPlugin(QObject * parent): QObject(parent) {
|
||||
m_initialized = false;
|
||||
}
|
||||
|
||||
|
||||
void ColorButtonPlugin::initialize(QDesignerFormEditorInterface * /* core */) {
|
||||
if (m_initialized)
|
||||
return;
|
||||
|
||||
// Add extension registrations, etc. here
|
||||
|
||||
m_initialized = true;
|
||||
}
|
||||
|
||||
|
||||
bool ColorButtonPlugin::isInitialized() const {
|
||||
return m_initialized;
|
||||
}
|
||||
|
||||
|
||||
QWidget * ColorButtonPlugin::createWidget(QWidget * parent) {
|
||||
return new ColorButton(parent);
|
||||
}
|
||||
|
||||
|
||||
QString ColorButtonPlugin::name() const {
|
||||
return QLatin1String("ColorButton");
|
||||
}
|
||||
|
||||
|
||||
QString ColorButtonPlugin::group() const {
|
||||
return QLatin1String("Buttons");
|
||||
}
|
||||
|
||||
|
||||
QIcon ColorButtonPlugin::icon() const {
|
||||
return QIcon(":/icons/colorbutton.png");
|
||||
}
|
||||
|
||||
|
||||
QString ColorButtonPlugin::toolTip() const {
|
||||
return QLatin1String("Color Button");
|
||||
}
|
||||
|
||||
|
||||
QString ColorButtonPlugin::whatsThis() const {
|
||||
return QLatin1String("Color Button");
|
||||
}
|
||||
|
||||
|
||||
bool ColorButtonPlugin::isContainer() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
QString ColorButtonPlugin::domXml() const {
|
||||
return QLatin1String("<widget class=\"ColorButton\" name=\"colorButton\">\n</widget>\n");
|
||||
}
|
||||
|
||||
|
||||
QString ColorButtonPlugin::includeFile() const {
|
||||
return QLatin1String("colorbutton.h");
|
||||
}
|
||||
|
||||
31
qad_widgets/colorbuttonplugin.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef COLORBUTTONPLUGIN_H
|
||||
#define COLORBUTTONPLUGIN_H
|
||||
|
||||
#include <QDesignerCustomWidgetInterface>
|
||||
|
||||
class ColorButtonPlugin: public QObject, public QDesignerCustomWidgetInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(QDesignerCustomWidgetInterface)
|
||||
|
||||
public:
|
||||
ColorButtonPlugin(QObject * parent = 0);
|
||||
|
||||
bool isContainer() const;
|
||||
bool isInitialized() const;
|
||||
QIcon icon() const;
|
||||
QString domXml() const;
|
||||
QString group() const;
|
||||
QString includeFile() const;
|
||||
QString name() const;
|
||||
QString toolTip() const;
|
||||
QString whatsThis() const;
|
||||
QWidget * createWidget(QWidget * parent);
|
||||
void initialize(QDesignerFormEditorInterface * core);
|
||||
|
||||
private:
|
||||
bool m_initialized;
|
||||
|
||||
};
|
||||
|
||||
#endif // COLORBUTTONPLUGIN_H
|
||||
92
qad_widgets/ecombobox.cpp
Normal file
@@ -0,0 +1,92 @@
|
||||
#include <QStandardItemModel>
|
||||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
#include <QHeaderView>
|
||||
#include "ecombobox.h"
|
||||
|
||||
|
||||
class EModel: public QStandardItemModel {
|
||||
public:
|
||||
EModel(QObject * parent = 0): QStandardItemModel(parent) {
|
||||
#if QT_VERSION < 0x050000
|
||||
setSupportedDragActions(Qt::MoveAction);
|
||||
#endif
|
||||
}
|
||||
protected:
|
||||
virtual Qt::ItemFlags flags(const QModelIndex & index) const {
|
||||
Qt::ItemFlags f = Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled;
|
||||
if (!index.isValid()) f |= Qt::ItemIsDropEnabled;
|
||||
return f;
|
||||
}
|
||||
#if QT_VERSION >= 0x050000
|
||||
Qt::DropActions supportedDragActions() const {return Qt::MoveAction;}
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
EComboBox::EComboBox(QWidget * parent): QComboBox(parent) {
|
||||
setView(&iv);
|
||||
setModel(new EModel());
|
||||
iv.setTextElideMode(Qt::ElideMiddle);
|
||||
iv.setRootIsDecorated(false);
|
||||
iv.setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||
iv.setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||
iv.setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
|
||||
iv.setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
|
||||
iv.setDragDropMode(QAbstractItemView::InternalMove);
|
||||
iv.setMinimumHeight(100);
|
||||
icon.setPixmap(QPixmap(":/icons/edit-find.png"));
|
||||
ifont = nfont = font();
|
||||
ifont.setItalic(true);
|
||||
#if QT_VERSION >= 0x040700
|
||||
filter.setPlaceholderText(tr("Filter"));
|
||||
filter.setFont(ifont);
|
||||
#endif
|
||||
header.setAutoFillBackground(true);
|
||||
header.setLayout(new QBoxLayout(QBoxLayout::LeftToRight));
|
||||
header.layout()->setSpacing(2);
|
||||
header.layout()->setContentsMargins(2, 0, 0, 0);
|
||||
header.layout()->addWidget(&icon);
|
||||
header.layout()->addWidget(&filter);
|
||||
header.setParent(iv.header());
|
||||
connect(&filter, SIGNAL(textChanged(QString)), this, SLOT(filterChanged(QString)));
|
||||
}
|
||||
|
||||
|
||||
void EComboBox::showPopup() {
|
||||
filterChanged(filter.text(), true);
|
||||
QComboBox::showPopup();
|
||||
QRect r = iv.header()->rect();
|
||||
header.setGeometry(r.x(), r.y(), r.width(), r.height() - 1);
|
||||
filter.setFocus();
|
||||
}
|
||||
|
||||
|
||||
void EComboBox::filterChanged(const QString & text, bool first) {
|
||||
if (filter.text().isEmpty()) filter.setFont(ifont);
|
||||
else filter.setFont(nfont);
|
||||
iv.hide();
|
||||
QModelIndex pi = iv.rootIndex();
|
||||
if (text.isEmpty()) {
|
||||
for (int i = 0; i < iv.model()->rowCount(); ++i) {
|
||||
iv.setRowHidden(i, pi, false);
|
||||
iv.model()->setData(iv.model()->index(i, 0), iv.model()->index(i, 0, pi).data().toString(), Qt::ToolTipRole);
|
||||
}
|
||||
iv.show();
|
||||
if (first) return;
|
||||
hidePopup();
|
||||
showPopup();
|
||||
qApp->processEvents();
|
||||
QRect r = iv.header()->rect();
|
||||
header.setGeometry(r.x(), r.y(), r.width(), r.height() - 1);
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < iv.model()->rowCount(); ++i) {
|
||||
iv.setRowHidden(i, pi, !iv.model()->index(i, 0, pi).data().toString().contains(QRegExp(text, Qt::CaseInsensitive)));
|
||||
iv.model()->setData(iv.model()->index(i, 0), iv.model()->index(i, 0, pi).data().toString(), Qt::ToolTipRole);
|
||||
}
|
||||
iv.show();
|
||||
qApp->processEvents();
|
||||
QRect r = iv.header()->rect();
|
||||
header.setGeometry(r.x(), r.y(), r.width(), r.height() - 1);
|
||||
}
|
||||
34
qad_widgets/ecombobox.h
Normal file
@@ -0,0 +1,34 @@
|
||||
#ifndef ECOMBOBOX_H
|
||||
#define ECOMBOBOX_H
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QBoxLayout>
|
||||
#include <QTreeView>
|
||||
#include <QLabel>
|
||||
#include "clineedit.h"
|
||||
|
||||
|
||||
class EComboBox: public QComboBox
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit EComboBox(QWidget * parent = 0);
|
||||
|
||||
public slots:
|
||||
virtual void showPopup();
|
||||
|
||||
private:
|
||||
QTreeView iv;
|
||||
QWidget header;
|
||||
QLabel icon;
|
||||
CLineEdit filter;
|
||||
QFont nfont, ifont;
|
||||
|
||||
private slots:
|
||||
void filterChanged(const QString & text, bool first = false);
|
||||
|
||||
signals:
|
||||
|
||||
};
|
||||
|
||||
#endif // ECOMBOBOX_H
|
||||
69
qad_widgets/ecomboboxplugin.cpp
Normal file
@@ -0,0 +1,69 @@
|
||||
#include "ecombobox.h"
|
||||
#include "ecomboboxplugin.h"
|
||||
#include <QtCore/QtPlugin>
|
||||
|
||||
|
||||
EComboBoxPlugin::EComboBoxPlugin(QObject * parent): QObject(parent) {
|
||||
m_initialized = false;
|
||||
}
|
||||
|
||||
|
||||
void EComboBoxPlugin::initialize(QDesignerFormEditorInterface * /* core */) {
|
||||
if (m_initialized)
|
||||
return;
|
||||
|
||||
// Add extension registrations, etc. here
|
||||
|
||||
m_initialized = true;
|
||||
}
|
||||
|
||||
|
||||
bool EComboBoxPlugin::isInitialized() const {
|
||||
return m_initialized;
|
||||
}
|
||||
|
||||
|
||||
QWidget * EComboBoxPlugin::createWidget(QWidget * parent) {
|
||||
return new EComboBox(parent);
|
||||
}
|
||||
|
||||
|
||||
QString EComboBoxPlugin::name() const {
|
||||
return QLatin1String("EComboBox");
|
||||
}
|
||||
|
||||
|
||||
QString EComboBoxPlugin::group() const {
|
||||
return QLatin1String("Input Widgets");
|
||||
}
|
||||
|
||||
|
||||
QIcon EComboBoxPlugin::icon() const {
|
||||
return QIcon(":/icons/ecombobox.png");
|
||||
}
|
||||
|
||||
|
||||
QString EComboBoxPlugin::toolTip() const {
|
||||
return QLatin1String("Combo Box with Search");
|
||||
}
|
||||
|
||||
|
||||
QString EComboBoxPlugin::whatsThis() const {
|
||||
return QLatin1String("Combo Box with Search");
|
||||
}
|
||||
|
||||
|
||||
bool EComboBoxPlugin::isContainer() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
QString EComboBoxPlugin::domXml() const {
|
||||
return QLatin1String("<widget class=\"EComboBox\" name=\"comboBox\">\n</widget>\n");
|
||||
}
|
||||
|
||||
|
||||
QString EComboBoxPlugin::includeFile() const {
|
||||
return QLatin1String("ecombobox.h");
|
||||
}
|
||||
|
||||
31
qad_widgets/ecomboboxplugin.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef ECOMBOBOXPLUGIN_H
|
||||
#define ECOMBOBOXPLUGIN_H
|
||||
|
||||
#include <QDesignerCustomWidgetInterface>
|
||||
|
||||
class EComboBoxPlugin: public QObject, public QDesignerCustomWidgetInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(QDesignerCustomWidgetInterface)
|
||||
|
||||
public:
|
||||
EComboBoxPlugin(QObject * parent = 0);
|
||||
|
||||
bool isContainer() const;
|
||||
bool isInitialized() const;
|
||||
QIcon icon() const;
|
||||
QString domXml() const;
|
||||
QString group() const;
|
||||
QString includeFile() const;
|
||||
QString name() const;
|
||||
QString toolTip() const;
|
||||
QString whatsThis() const;
|
||||
QWidget * createWidget(QWidget * parent);
|
||||
void initialize(QDesignerFormEditorInterface * core);
|
||||
|
||||
private:
|
||||
bool m_initialized;
|
||||
|
||||
};
|
||||
|
||||
#endif // ECOMBOBOXPLUGIN_H
|
||||
0
qad_widgets/gpio.conf
Normal file
68
qad_widgets/iconedlabel.h
Normal file
@@ -0,0 +1,68 @@
|
||||
#ifndef ICONEDLABEL_H
|
||||
#define ICONEDLABEL_H
|
||||
|
||||
#include <QLabel>
|
||||
#include <QIcon>
|
||||
#include <QHBoxLayout>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class IconedLabel: public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_ENUMS(Direction)
|
||||
Q_PROPERTY(QString text READ text WRITE setText)
|
||||
Q_PROPERTY(QIcon icon READ icon WRITE setIcon)
|
||||
Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize)
|
||||
Q_PROPERTY(Direction direction READ direction WRITE setDirection)
|
||||
public:
|
||||
enum Direction {LeftToRight = 0, RightToLeft = 1, TopToBottom = 2, BottomToTop = 3};
|
||||
|
||||
explicit IconedLabel(QWidget * parent = 0): QFrame(parent) {
|
||||
label_.setAlignment(Qt::AlignCenter);
|
||||
icon_.setAlignment(Qt::AlignCenter);
|
||||
size_ = QSize(16, 16);
|
||||
setDirection(LeftToRight);
|
||||
}
|
||||
|
||||
QString text() const {return label_.text();}
|
||||
QIcon icon() const {return icon_.pixmap() == 0 ? QIcon() : QIcon(*icon_.pixmap());}
|
||||
QSize iconSize() const {return size_;}
|
||||
Direction direction() const {return dir_;}
|
||||
|
||||
protected:
|
||||
QLabel label_;
|
||||
QLabel icon_;
|
||||
QIcon sicon_;
|
||||
QSize size_;
|
||||
Direction dir_;
|
||||
|
||||
public slots:
|
||||
void setText(const QString & t) {label_.setText(t);}
|
||||
void setIcon(const QIcon & i) {sicon_ = i; icon_.setPixmap(i.pixmap(size_));}
|
||||
void setIconSize(const QSize & s) {size_ = s; icon_.setPixmap(sicon_.pixmap(size_));}
|
||||
void setDirection(Direction d) {
|
||||
dir_ = d;
|
||||
if (layout() != 0)
|
||||
delete layout();
|
||||
QLayout * lay = new QBoxLayout((QBoxLayout::Direction)dir_);
|
||||
lay->addItem(new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Expanding));
|
||||
lay->addWidget(&label_);
|
||||
lay->addWidget(&icon_);
|
||||
lay->addItem(new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Expanding));
|
||||
lay->setContentsMargins(0, 0, 0, 0);
|
||||
setLayout(lay);
|
||||
update();
|
||||
}
|
||||
|
||||
signals:
|
||||
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // ICONEDLABEL_H
|
||||
31
qad_widgets/iconedlabelplugin.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef ICONEDLABEPLUGIN_H
|
||||
#define ICONEDLABEPLUGIN_H
|
||||
|
||||
#include <QDesignerCustomWidgetInterface>
|
||||
|
||||
class IconedLabelPlugin: public QObject, public QDesignerCustomWidgetInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(QDesignerCustomWidgetInterface)
|
||||
|
||||
public:
|
||||
IconedLabelPlugin(QObject * parent = 0);
|
||||
|
||||
bool isContainer() const;
|
||||
bool isInitialized() const;
|
||||
QIcon icon() const;
|
||||
QString domXml() const;
|
||||
QString group() const;
|
||||
QString includeFile() const;
|
||||
QString name() const;
|
||||
QString toolTip() const;
|
||||
QString whatsThis() const;
|
||||
QWidget * createWidget(QWidget * parent);
|
||||
void initialize(QDesignerFormEditorInterface * core);
|
||||
|
||||
private:
|
||||
bool m_initialized;
|
||||
|
||||
};
|
||||
|
||||
#endif // ICONEDLABEPLUGIN_H
|
||||
BIN
qad_widgets/icons/alpha.png
Normal file
|
After Width: | Height: | Size: 158 B |
BIN
qad_widgets/icons/border-line.png
Normal file
|
After Width: | Height: | Size: 183 B |
BIN
qad_widgets/icons/chardialog.png
Normal file
|
After Width: | Height: | Size: 943 B |
BIN
qad_widgets/icons/clineedit.png
Normal file
|
After Width: | Height: | Size: 8.9 KiB |
BIN
qad_widgets/icons/code-word.png
Normal file
|
After Width: | Height: | Size: 543 B |
BIN
qad_widgets/icons/colorbutton.png
Normal file
|
After Width: | Height: | Size: 7.3 KiB |
BIN
qad_widgets/icons/configure.png
Normal file
|
After Width: | Height: | Size: 717 B |
BIN
qad_widgets/icons/dialog-close.png
Normal file
|
After Width: | Height: | Size: 813 B |
BIN
qad_widgets/icons/document-open.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
qad_widgets/icons/document-save.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
qad_widgets/icons/ecombobox.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
qad_widgets/icons/edit-clear-locationbar-rtl.png
Normal file
|
After Width: | Height: | Size: 644 B |
BIN
qad_widgets/icons/edit-clear.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
qad_widgets/icons/edit-copy.png
Normal file
|
After Width: | Height: | Size: 485 B |
BIN
qad_widgets/icons/edit-delete.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
qad_widgets/icons/edit-find.png
Normal file
|
After Width: | Height: | Size: 634 B |
BIN
qad_widgets/icons/edit-guides.png
Normal file
|
After Width: | Height: | Size: 544 B |
BIN
qad_widgets/icons/edit-paste.png
Normal file
|
After Width: | Height: | Size: 529 B |
BIN
qad_widgets/icons/etabwidget.png
Normal file
|
After Width: | Height: | Size: 693 B |
BIN
qad_widgets/icons/expand_s_x.png
Normal file
|
After Width: | Height: | Size: 571 B |
BIN
qad_widgets/icons/expand_s_y.png
Normal file
|
After Width: | Height: | Size: 577 B |
BIN
qad_widgets/icons/expand_x.png
Normal file
|
After Width: | Height: | Size: 579 B |
BIN
qad_widgets/icons/expand_y.png
Normal file
|
After Width: | Height: | Size: 577 B |
BIN
qad_widgets/icons/item-add.png
Normal file
|
After Width: | Height: | Size: 639 B |
BIN
qad_widgets/icons/item.png
Normal file
|
After Width: | Height: | Size: 448 B |
BIN
qad_widgets/icons/legend.png
Normal file
|
After Width: | Height: | Size: 810 B |
BIN
qad_widgets/icons/list-add.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
qad_widgets/icons/node-add.png
Normal file
|
After Width: | Height: | Size: 694 B |
BIN
qad_widgets/icons/node.png
Normal file
|
After Width: | Height: | Size: 658 B |
BIN
qad_widgets/icons/qcodeedit.png
Normal file
|
After Width: | Height: | Size: 818 B |
BIN
qad_widgets/icons/qpiconsole.png
Normal file
|
After Width: | Height: | Size: 9.6 KiB |
BIN
qad_widgets/icons/qvariantedit.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
qad_widgets/icons/spinslider.png
Normal file
|
After Width: | Height: | Size: 830 B |
BIN
qad_widgets/icons/view-grid.png
Normal file
|
After Width: | Height: | Size: 691 B |
BIN
qad_widgets/icons/zoom-fit-best.png
Normal file
|
After Width: | Height: | Size: 539 B |
BIN
qad_widgets/lang/qad_widgets_ru.qm
Normal file
853
qad_widgets/lang/qad_widgets_ru.ts
Normal file
@@ -0,0 +1,853 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.0" language="ru_RU">
|
||||
<context>
|
||||
<name>CLineEdit</name>
|
||||
<message>
|
||||
<location filename="../clineedit.cpp" line="8"/>
|
||||
<location filename="../clineedit.cpp" line="23"/>
|
||||
<source>Clear</source>
|
||||
<translation>Сбросить</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>CharDialog</name>
|
||||
<message>
|
||||
<location filename="../chardialog.ui" line="14"/>
|
||||
<source>Choose symbol</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="21"/>
|
||||
<location filename="../chardialog.cpp" line="40"/>
|
||||
<source>No Category</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="21"/>
|
||||
<location filename="../chardialog.cpp" line="40"/>
|
||||
<source>Mark NonSpacing</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="21"/>
|
||||
<location filename="../chardialog.cpp" line="40"/>
|
||||
<source>Mark SpacingCombining</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="21"/>
|
||||
<location filename="../chardialog.cpp" line="40"/>
|
||||
<source>Mark Enclosing</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="22"/>
|
||||
<location filename="../chardialog.cpp" line="41"/>
|
||||
<source>Number DecimalDigit</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="22"/>
|
||||
<location filename="../chardialog.cpp" line="41"/>
|
||||
<source>Number Letter</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="22"/>
|
||||
<location filename="../chardialog.cpp" line="41"/>
|
||||
<source>Number Other</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="22"/>
|
||||
<location filename="../chardialog.cpp" line="41"/>
|
||||
<source>Separator Space</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="23"/>
|
||||
<location filename="../chardialog.cpp" line="42"/>
|
||||
<source>Separator Line</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="23"/>
|
||||
<location filename="../chardialog.cpp" line="42"/>
|
||||
<source>Separator Paragraph</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="23"/>
|
||||
<location filename="../chardialog.cpp" line="42"/>
|
||||
<source>Other Control</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="23"/>
|
||||
<location filename="../chardialog.cpp" line="42"/>
|
||||
<source>Other Format</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="24"/>
|
||||
<location filename="../chardialog.cpp" line="43"/>
|
||||
<source>Other Surrogate</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="24"/>
|
||||
<location filename="../chardialog.cpp" line="43"/>
|
||||
<source>Other PrivateUse</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="24"/>
|
||||
<location filename="../chardialog.cpp" line="43"/>
|
||||
<source>Other NotAssigned</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="24"/>
|
||||
<location filename="../chardialog.cpp" line="43"/>
|
||||
<source>Letter Uppercase</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="25"/>
|
||||
<location filename="../chardialog.cpp" line="44"/>
|
||||
<source>Letter Lowercase</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="25"/>
|
||||
<location filename="../chardialog.cpp" line="44"/>
|
||||
<source>Letter Titlecase</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="25"/>
|
||||
<location filename="../chardialog.cpp" line="44"/>
|
||||
<source>Letter Modifier</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="25"/>
|
||||
<location filename="../chardialog.cpp" line="44"/>
|
||||
<source>Letter Other</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="26"/>
|
||||
<location filename="../chardialog.cpp" line="45"/>
|
||||
<source>Punctuation Connector</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="26"/>
|
||||
<location filename="../chardialog.cpp" line="45"/>
|
||||
<source>Punctuation Dash</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="26"/>
|
||||
<location filename="../chardialog.cpp" line="45"/>
|
||||
<source>Punctuation Open</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="26"/>
|
||||
<location filename="../chardialog.cpp" line="45"/>
|
||||
<source>Punctuation Close</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="27"/>
|
||||
<location filename="../chardialog.cpp" line="46"/>
|
||||
<source>Punctuation InitialQuote</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="27"/>
|
||||
<location filename="../chardialog.cpp" line="46"/>
|
||||
<source>Punctuation FinalQuote</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="27"/>
|
||||
<location filename="../chardialog.cpp" line="46"/>
|
||||
<source>Punctuation Other</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="27"/>
|
||||
<location filename="../chardialog.cpp" line="46"/>
|
||||
<source>Symbol Math</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="28"/>
|
||||
<location filename="../chardialog.cpp" line="47"/>
|
||||
<source>Symbol Currency</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="28"/>
|
||||
<location filename="../chardialog.cpp" line="47"/>
|
||||
<source>Symbol Modifier</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="28"/>
|
||||
<location filename="../chardialog.cpp" line="47"/>
|
||||
<source>Symbol Other</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ColorButton</name>
|
||||
<message>
|
||||
<location filename="../colorbutton.cpp" line="17"/>
|
||||
<source>Copy</source>
|
||||
<translation>Копировать</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../colorbutton.cpp" line="18"/>
|
||||
<source>Paste</source>
|
||||
<translation>Вставить</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../colorbutton.cpp" line="20"/>
|
||||
<source>Mix with clipboard</source>
|
||||
<translation>Смешать с буфером обмена</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../colorbutton.cpp" line="87"/>
|
||||
<source>Choose color</source>
|
||||
<translation>Выберите цвет</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>EComboBox</name>
|
||||
<message>
|
||||
<location filename="../ecombobox.cpp" line="17"/>
|
||||
<source>Filter</source>
|
||||
<translation>Фильтр</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Graphic</name>
|
||||
<message>
|
||||
<location filename="../graphic.ui" line="44"/>
|
||||
<source>Autofit</source>
|
||||
<translation>Вписать</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.ui" line="61"/>
|
||||
<source>Grid</source>
|
||||
<translation>Сетка</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.ui" line="84"/>
|
||||
<source>Cursor axis</source>
|
||||
<translation>Координаты курсора</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.ui" line="104"/>
|
||||
<source>Only expand Y</source>
|
||||
<translation>Только расширять по Y</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.ui" line="124"/>
|
||||
<source>Only expand X</source>
|
||||
<translation>Только расширять по X</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.ui" line="144"/>
|
||||
<source>Border inputs</source>
|
||||
<translation>Граничные поля ввода</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.ui" line="167"/>
|
||||
<source>Legend</source>
|
||||
<translation>Легенда</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.ui" line="190"/>
|
||||
<source>Configure ...</source>
|
||||
<translation>Настроить ...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.ui" line="207"/>
|
||||
<source>Save image ...</source>
|
||||
<translation>Сохранить изображение ...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.ui" line="240"/>
|
||||
<source>Clear</source>
|
||||
<translation>Очистить</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.ui" line="257"/>
|
||||
<source>Close</source>
|
||||
<translation>Закрыть</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.ui" line="408"/>
|
||||
<source>Cursor: ( ; )</source>
|
||||
<translation>Курсор: ( ; )</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="196"/>
|
||||
<location filename="../graphic.cpp" line="763"/>
|
||||
<source>Cursor: </source>
|
||||
<translation>Курсор: </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="206"/>
|
||||
<source>Selection</source>
|
||||
<translation>Выбрано</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="207"/>
|
||||
<source>Size</source>
|
||||
<translation>Размер</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="211"/>
|
||||
<location filename="../graphic.cpp" line="217"/>
|
||||
<source>Range</source>
|
||||
<translation>Диапазон</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="212"/>
|
||||
<location filename="../graphic.cpp" line="218"/>
|
||||
<source>Length</source>
|
||||
<translation>Длина</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="316"/>
|
||||
<location filename="../graphic.cpp" line="346"/>
|
||||
<source>Cursor</source>
|
||||
<translation>Курсор</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="487"/>
|
||||
<source>Save Image</source>
|
||||
<translation>Соханение изображения</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="532"/>
|
||||
<source>y(x)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="1075"/>
|
||||
<source>Check all</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>GraphicConf</name>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="17"/>
|
||||
<source>Graphic parameters</source>
|
||||
<translation>Параметры графика</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="32"/>
|
||||
<source>Appearance</source>
|
||||
<translation>Внешний вид</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="46"/>
|
||||
<source>Border inputs</source>
|
||||
<translation>Граничные поля ввода</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="53"/>
|
||||
<source>Antialiasing</source>
|
||||
<translation>Антиалиасинг</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="60"/>
|
||||
<source>Status bar</source>
|
||||
<translation>Строка состояния</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="67"/>
|
||||
<source>OpenGL</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="74"/>
|
||||
<source>Legend</source>
|
||||
<translation>Легенда</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="94"/>
|
||||
<source>Background color:</source>
|
||||
<translation>Цвет фона:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="114"/>
|
||||
<source>Text color:</source>
|
||||
<translation>Цвет текста:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="245"/>
|
||||
<source>Grid</source>
|
||||
<translation>Сетка</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="380"/>
|
||||
<source>Margins</source>
|
||||
<translation>Отступы</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="392"/>
|
||||
<location filename="../graphic_conf.ui" line="402"/>
|
||||
<location filename="../graphic_conf.ui" line="422"/>
|
||||
<location filename="../graphic_conf.ui" line="462"/>
|
||||
<location filename="../graphic_conf.ui" line="482"/>
|
||||
<source> px</source>
|
||||
<translation> пикс</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="412"/>
|
||||
<source>All:</source>
|
||||
<translation>Все:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="432"/>
|
||||
<source>Right:</source>
|
||||
<translation>Правый:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="442"/>
|
||||
<source>Left:</source>
|
||||
<translation>Левый:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="452"/>
|
||||
<source>Bottom:</source>
|
||||
<translation>Нижний:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="472"/>
|
||||
<source>Top:</source>
|
||||
<translation>Верхний:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="161"/>
|
||||
<location filename="../graphic_conf.ui" line="263"/>
|
||||
<source>Color:</source>
|
||||
<translation>Цвет:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="175"/>
|
||||
<location filename="../graphic_conf.ui" line="277"/>
|
||||
<source>Style:</source>
|
||||
<translation>Стиль:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="287"/>
|
||||
<source>Width:</source>
|
||||
<translation>Толщина:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="317"/>
|
||||
<source>Step X:</source>
|
||||
<translation>Шаг X:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="324"/>
|
||||
<source>Step Y:</source>
|
||||
<translation>Шаг Y:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="347"/>
|
||||
<source>Auto step</source>
|
||||
<translation>Автоматическая</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="133"/>
|
||||
<source>Graphics</source>
|
||||
<translation>Графики</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="185"/>
|
||||
<source>Lines width:</source>
|
||||
<translation>Толщина линий:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="205"/>
|
||||
<source>Points width:</source>
|
||||
<translation>Толщина точек:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="225"/>
|
||||
<source>Fill:</source>
|
||||
<translation>Заливка:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.cpp" line="7"/>
|
||||
<source>NoPen</source>
|
||||
<translation>Без линий</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.cpp" line="7"/>
|
||||
<source>Solid</source>
|
||||
<translation>Сплошная</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.cpp" line="7"/>
|
||||
<source>Dash</source>
|
||||
<translation>Штриховая</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.cpp" line="8"/>
|
||||
<source>Dot</source>
|
||||
<translation>Пунктирная</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.cpp" line="8"/>
|
||||
<source>Dash-Dot</source>
|
||||
<translation>Штрих-пунктирная</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.cpp" line="8"/>
|
||||
<source>Dash-Dot-Dot</source>
|
||||
<translation>Штрих-пунктир-пунктирная</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>QPIConfigNewDialog</name>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="20"/>
|
||||
<source>Dialog</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="26"/>
|
||||
<source>Type</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="32"/>
|
||||
<source>string</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="38"/>
|
||||
<source>s</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="45"/>
|
||||
<source>integer</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="48"/>
|
||||
<source>n</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="55"/>
|
||||
<source>float</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="58"/>
|
||||
<source>f</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="65"/>
|
||||
<source>string list</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="68"/>
|
||||
<source>l</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="75"/>
|
||||
<source>boolean</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="78"/>
|
||||
<source>b</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="85"/>
|
||||
<source>color</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="88"/>
|
||||
<source>c</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="95"/>
|
||||
<source>rectangle</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="98"/>
|
||||
<source>r</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="105"/>
|
||||
<source>area</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="108"/>
|
||||
<source>a</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="115"/>
|
||||
<source>point</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="118"/>
|
||||
<source>p</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="125"/>
|
||||
<source>vector</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="128"/>
|
||||
<source>v</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="135"/>
|
||||
<source>ip</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="138"/>
|
||||
<source>i</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="148"/>
|
||||
<source>Name:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="181"/>
|
||||
<source>Comment:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="191"/>
|
||||
<source>Value:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>QPIConfigWidget</name>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="341"/>
|
||||
<source>Name</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="341"/>
|
||||
<source>Value</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="341"/>
|
||||
<source>Type</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="341"/>
|
||||
<source>Comment</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="345"/>
|
||||
<source>string</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="346"/>
|
||||
<source>string list</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="347"/>
|
||||
<source>integer</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="348"/>
|
||||
<source>float</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="349"/>
|
||||
<source>boolean</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="350"/>
|
||||
<source>color</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="351"/>
|
||||
<source>rectangle</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="352"/>
|
||||
<source>area</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="353"/>
|
||||
<source>point</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="354"/>
|
||||
<source>vector</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="355"/>
|
||||
<source>ip</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="356"/>
|
||||
<source>Add item ...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="357"/>
|
||||
<source>Add node ...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="358"/>
|
||||
<source>Convert to item</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="359"/>
|
||||
<source>Convert to node</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="360"/>
|
||||
<source>Remove</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="361"/>
|
||||
<source>Expand all</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="362"/>
|
||||
<source>Collapse all</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>QPointEdit</name>
|
||||
<message>
|
||||
<location filename="../qpointedit.cpp" line="11"/>
|
||||
<location filename="../qpointedit.cpp" line="28"/>
|
||||
<source>X</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpointedit.cpp" line="12"/>
|
||||
<location filename="../qpointedit.cpp" line="29"/>
|
||||
<source>Y</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>QRectEdit</name>
|
||||
<message>
|
||||
<location filename="../qrectedit.cpp" line="17"/>
|
||||
<location filename="../qrectedit.cpp" line="48"/>
|
||||
<source>X</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qrectedit.cpp" line="18"/>
|
||||
<location filename="../qrectedit.cpp" line="49"/>
|
||||
<source>Y</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qrectedit.cpp" line="19"/>
|
||||
<location filename="../qrectedit.cpp" line="50"/>
|
||||
<source>Height</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qrectedit.cpp" line="20"/>
|
||||
<location filename="../qrectedit.cpp" line="51"/>
|
||||
<source>Width</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Shortcuts</name>
|
||||
<message>
|
||||
<location filename="../shortcuts.cpp" line="33"/>
|
||||
<location filename="../shortcuts.cpp" line="49"/>
|
||||
<source>Command</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shortcuts.cpp" line="33"/>
|
||||
<location filename="../shortcuts.cpp" line="49"/>
|
||||
<source>Shortcut</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>StringListEdit</name>
|
||||
<message>
|
||||
<location filename="../qpiconfigvaluewidget.cpp" line="20"/>
|
||||
<location filename="../qpiconfigvaluewidget.cpp" line="37"/>
|
||||
<source>Add</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigvaluewidget.cpp" line="21"/>
|
||||
<location filename="../qpiconfigvaluewidget.cpp" line="38"/>
|
||||
<source>Remove</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigvaluewidget.cpp" line="22"/>
|
||||
<location filename="../qpiconfigvaluewidget.cpp" line="39"/>
|
||||
<source>Clear</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
BIN
qad_widgets/lang/ru.qm
Normal file
853
qad_widgets/lang/ru.ts
Normal file
@@ -0,0 +1,853 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.0" language="ru_RU">
|
||||
<context>
|
||||
<name>CLineEdit</name>
|
||||
<message>
|
||||
<location filename="../clineedit.cpp" line="8"/>
|
||||
<location filename="../clineedit.cpp" line="23"/>
|
||||
<source>Clear</source>
|
||||
<translation>Сбросить</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>CharDialog</name>
|
||||
<message>
|
||||
<location filename="../chardialog.ui" line="14"/>
|
||||
<source>Choose symbol</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="21"/>
|
||||
<location filename="../chardialog.cpp" line="40"/>
|
||||
<source>No Category</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="21"/>
|
||||
<location filename="../chardialog.cpp" line="40"/>
|
||||
<source>Mark NonSpacing</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="21"/>
|
||||
<location filename="../chardialog.cpp" line="40"/>
|
||||
<source>Mark SpacingCombining</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="21"/>
|
||||
<location filename="../chardialog.cpp" line="40"/>
|
||||
<source>Mark Enclosing</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="22"/>
|
||||
<location filename="../chardialog.cpp" line="41"/>
|
||||
<source>Number DecimalDigit</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="22"/>
|
||||
<location filename="../chardialog.cpp" line="41"/>
|
||||
<source>Number Letter</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="22"/>
|
||||
<location filename="../chardialog.cpp" line="41"/>
|
||||
<source>Number Other</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="22"/>
|
||||
<location filename="../chardialog.cpp" line="41"/>
|
||||
<source>Separator Space</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="23"/>
|
||||
<location filename="../chardialog.cpp" line="42"/>
|
||||
<source>Separator Line</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="23"/>
|
||||
<location filename="../chardialog.cpp" line="42"/>
|
||||
<source>Separator Paragraph</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="23"/>
|
||||
<location filename="../chardialog.cpp" line="42"/>
|
||||
<source>Other Control</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="23"/>
|
||||
<location filename="../chardialog.cpp" line="42"/>
|
||||
<source>Other Format</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="24"/>
|
||||
<location filename="../chardialog.cpp" line="43"/>
|
||||
<source>Other Surrogate</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="24"/>
|
||||
<location filename="../chardialog.cpp" line="43"/>
|
||||
<source>Other PrivateUse</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="24"/>
|
||||
<location filename="../chardialog.cpp" line="43"/>
|
||||
<source>Other NotAssigned</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="24"/>
|
||||
<location filename="../chardialog.cpp" line="43"/>
|
||||
<source>Letter Uppercase</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="25"/>
|
||||
<location filename="../chardialog.cpp" line="44"/>
|
||||
<source>Letter Lowercase</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="25"/>
|
||||
<location filename="../chardialog.cpp" line="44"/>
|
||||
<source>Letter Titlecase</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="25"/>
|
||||
<location filename="../chardialog.cpp" line="44"/>
|
||||
<source>Letter Modifier</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="25"/>
|
||||
<location filename="../chardialog.cpp" line="44"/>
|
||||
<source>Letter Other</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="26"/>
|
||||
<location filename="../chardialog.cpp" line="45"/>
|
||||
<source>Punctuation Connector</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="26"/>
|
||||
<location filename="../chardialog.cpp" line="45"/>
|
||||
<source>Punctuation Dash</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="26"/>
|
||||
<location filename="../chardialog.cpp" line="45"/>
|
||||
<source>Punctuation Open</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="26"/>
|
||||
<location filename="../chardialog.cpp" line="45"/>
|
||||
<source>Punctuation Close</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="27"/>
|
||||
<location filename="../chardialog.cpp" line="46"/>
|
||||
<source>Punctuation InitialQuote</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="27"/>
|
||||
<location filename="../chardialog.cpp" line="46"/>
|
||||
<source>Punctuation FinalQuote</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="27"/>
|
||||
<location filename="../chardialog.cpp" line="46"/>
|
||||
<source>Punctuation Other</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="27"/>
|
||||
<location filename="../chardialog.cpp" line="46"/>
|
||||
<source>Symbol Math</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="28"/>
|
||||
<location filename="../chardialog.cpp" line="47"/>
|
||||
<source>Symbol Currency</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="28"/>
|
||||
<location filename="../chardialog.cpp" line="47"/>
|
||||
<source>Symbol Modifier</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../chardialog.cpp" line="28"/>
|
||||
<location filename="../chardialog.cpp" line="47"/>
|
||||
<source>Symbol Other</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ColorButton</name>
|
||||
<message>
|
||||
<location filename="../colorbutton.cpp" line="17"/>
|
||||
<source>Copy</source>
|
||||
<translation>Копировать</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../colorbutton.cpp" line="18"/>
|
||||
<source>Paste</source>
|
||||
<translation>Вставить</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../colorbutton.cpp" line="20"/>
|
||||
<source>Mix with clipboard</source>
|
||||
<translation>Смешать с буфером обмена</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../colorbutton.cpp" line="87"/>
|
||||
<source>Choose color</source>
|
||||
<translation>Выберите цвет</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>EComboBox</name>
|
||||
<message>
|
||||
<location filename="../ecombobox.cpp" line="17"/>
|
||||
<source>Filter</source>
|
||||
<translation>Фильтр</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Graphic</name>
|
||||
<message>
|
||||
<location filename="../graphic.ui" line="44"/>
|
||||
<source>Autofit</source>
|
||||
<translation>Вписать</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.ui" line="61"/>
|
||||
<source>Grid</source>
|
||||
<translation>Сетка</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.ui" line="84"/>
|
||||
<source>Cursor axis</source>
|
||||
<translation>Координаты курсора</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.ui" line="104"/>
|
||||
<source>Only expand Y</source>
|
||||
<translation>Только расширять по Y</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.ui" line="124"/>
|
||||
<source>Only expand X</source>
|
||||
<translation>Только расширять по X</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.ui" line="144"/>
|
||||
<source>Border inputs</source>
|
||||
<translation>Граничные поля ввода</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.ui" line="167"/>
|
||||
<source>Legend</source>
|
||||
<translation>Легенда</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.ui" line="190"/>
|
||||
<source>Configure ...</source>
|
||||
<translation>Настроить ...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.ui" line="207"/>
|
||||
<source>Save image ...</source>
|
||||
<translation>Сохранить изображение ...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.ui" line="240"/>
|
||||
<source>Clear</source>
|
||||
<translation>Очистить</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.ui" line="257"/>
|
||||
<source>Close</source>
|
||||
<translation>Закрыть</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.ui" line="408"/>
|
||||
<source>Cursor: ( ; )</source>
|
||||
<translation>Курсор: ( ; )</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="196"/>
|
||||
<location filename="../graphic.cpp" line="763"/>
|
||||
<source>Cursor: </source>
|
||||
<translation>Курсор: </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="206"/>
|
||||
<source>Selection</source>
|
||||
<translation>Выбрано</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="207"/>
|
||||
<source>Size</source>
|
||||
<translation>Размер</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="211"/>
|
||||
<location filename="../graphic.cpp" line="217"/>
|
||||
<source>Range</source>
|
||||
<translation>Диапазон</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="212"/>
|
||||
<location filename="../graphic.cpp" line="218"/>
|
||||
<source>Length</source>
|
||||
<translation>Длина</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="316"/>
|
||||
<location filename="../graphic.cpp" line="346"/>
|
||||
<source>Cursor</source>
|
||||
<translation>Курсор</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="487"/>
|
||||
<source>Save Image</source>
|
||||
<translation>Соханение изображения</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="532"/>
|
||||
<source>y(x)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic.cpp" line="1075"/>
|
||||
<source>Check all</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>GraphicConf</name>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="17"/>
|
||||
<source>Graphic parameters</source>
|
||||
<translation>Параметры графика</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="32"/>
|
||||
<source>Appearance</source>
|
||||
<translation>Внешний вид</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="46"/>
|
||||
<source>Border inputs</source>
|
||||
<translation>Граничные поля ввода</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="53"/>
|
||||
<source>Antialiasing</source>
|
||||
<translation>Антиалиасинг</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="60"/>
|
||||
<source>Status bar</source>
|
||||
<translation>Строка состояния</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="67"/>
|
||||
<source>OpenGL</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="74"/>
|
||||
<source>Legend</source>
|
||||
<translation>Легенда</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="94"/>
|
||||
<source>Background color:</source>
|
||||
<translation>Цвет фона:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="114"/>
|
||||
<source>Text color:</source>
|
||||
<translation>Цвет текста:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="245"/>
|
||||
<source>Grid</source>
|
||||
<translation>Сетка</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="380"/>
|
||||
<source>Margins</source>
|
||||
<translation>Отступы</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="392"/>
|
||||
<location filename="../graphic_conf.ui" line="402"/>
|
||||
<location filename="../graphic_conf.ui" line="422"/>
|
||||
<location filename="../graphic_conf.ui" line="462"/>
|
||||
<location filename="../graphic_conf.ui" line="482"/>
|
||||
<source> px</source>
|
||||
<translation> пикс</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="412"/>
|
||||
<source>All:</source>
|
||||
<translation>Все:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="432"/>
|
||||
<source>Right:</source>
|
||||
<translation>Правый:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="442"/>
|
||||
<source>Left:</source>
|
||||
<translation>Левый:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="452"/>
|
||||
<source>Bottom:</source>
|
||||
<translation>Нижний:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="472"/>
|
||||
<source>Top:</source>
|
||||
<translation>Верхний:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="161"/>
|
||||
<location filename="../graphic_conf.ui" line="263"/>
|
||||
<source>Color:</source>
|
||||
<translation>Цвет:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="175"/>
|
||||
<location filename="../graphic_conf.ui" line="277"/>
|
||||
<source>Style:</source>
|
||||
<translation>Стиль:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="287"/>
|
||||
<source>Width:</source>
|
||||
<translation>Толщина:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="317"/>
|
||||
<source>Step X:</source>
|
||||
<translation>Шаг X:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="324"/>
|
||||
<source>Step Y:</source>
|
||||
<translation>Шаг Y:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="347"/>
|
||||
<source>Auto step</source>
|
||||
<translation>Автоматическая</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="133"/>
|
||||
<source>Graphics</source>
|
||||
<translation>Графики</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="185"/>
|
||||
<source>Lines width:</source>
|
||||
<translation>Толщина линий:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="205"/>
|
||||
<source>Points width:</source>
|
||||
<translation>Толщина точек:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.ui" line="225"/>
|
||||
<source>Fill:</source>
|
||||
<translation>Заливка:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.cpp" line="7"/>
|
||||
<source>NoPen</source>
|
||||
<translation>Без линий</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.cpp" line="7"/>
|
||||
<source>Solid</source>
|
||||
<translation>Сплошная</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.cpp" line="7"/>
|
||||
<source>Dash</source>
|
||||
<translation>Штриховая</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.cpp" line="8"/>
|
||||
<source>Dot</source>
|
||||
<translation>Пунктирная</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.cpp" line="8"/>
|
||||
<source>Dash-Dot</source>
|
||||
<translation>Штрих-пунктирная</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../graphic_conf.cpp" line="8"/>
|
||||
<source>Dash-Dot-Dot</source>
|
||||
<translation>Штрих-пунктир-пунктирная</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>QPIConfigNewDialog</name>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="20"/>
|
||||
<source>Dialog</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="26"/>
|
||||
<source>Type</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="32"/>
|
||||
<source>string</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="38"/>
|
||||
<source>s</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="45"/>
|
||||
<source>integer</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="48"/>
|
||||
<source>n</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="55"/>
|
||||
<source>float</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="58"/>
|
||||
<source>f</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="65"/>
|
||||
<source>string list</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="68"/>
|
||||
<source>l</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="75"/>
|
||||
<source>boolean</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="78"/>
|
||||
<source>b</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="85"/>
|
||||
<source>color</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="88"/>
|
||||
<source>c</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="95"/>
|
||||
<source>rectangle</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="98"/>
|
||||
<source>r</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="105"/>
|
||||
<source>area</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="108"/>
|
||||
<source>a</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="115"/>
|
||||
<source>point</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="118"/>
|
||||
<source>p</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="125"/>
|
||||
<source>vector</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="128"/>
|
||||
<source>v</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="135"/>
|
||||
<source>ip</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="138"/>
|
||||
<source>i</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="148"/>
|
||||
<source>Name:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="181"/>
|
||||
<source>Comment:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfignewdialog.ui" line="191"/>
|
||||
<source>Value:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>QPIConfigWidget</name>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="341"/>
|
||||
<source>Name</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="341"/>
|
||||
<source>Value</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="341"/>
|
||||
<source>Type</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="341"/>
|
||||
<source>Comment</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="345"/>
|
||||
<source>string</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="346"/>
|
||||
<source>string list</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="347"/>
|
||||
<source>integer</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="348"/>
|
||||
<source>float</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="349"/>
|
||||
<source>boolean</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="350"/>
|
||||
<source>color</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="351"/>
|
||||
<source>rectangle</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="352"/>
|
||||
<source>area</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="353"/>
|
||||
<source>point</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="354"/>
|
||||
<source>vector</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="355"/>
|
||||
<source>ip</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="356"/>
|
||||
<source>Add item ...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="357"/>
|
||||
<source>Add node ...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="358"/>
|
||||
<source>Convert to item</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="359"/>
|
||||
<source>Convert to node</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="360"/>
|
||||
<source>Remove</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="361"/>
|
||||
<source>Expand all</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="362"/>
|
||||
<source>Collapse all</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>QPointEdit</name>
|
||||
<message>
|
||||
<location filename="../qpointedit.cpp" line="11"/>
|
||||
<location filename="../qpointedit.cpp" line="28"/>
|
||||
<source>X</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpointedit.cpp" line="12"/>
|
||||
<location filename="../qpointedit.cpp" line="29"/>
|
||||
<source>Y</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>QRectEdit</name>
|
||||
<message>
|
||||
<location filename="../qrectedit.cpp" line="17"/>
|
||||
<location filename="../qrectedit.cpp" line="48"/>
|
||||
<source>X</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qrectedit.cpp" line="18"/>
|
||||
<location filename="../qrectedit.cpp" line="49"/>
|
||||
<source>Y</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qrectedit.cpp" line="19"/>
|
||||
<location filename="../qrectedit.cpp" line="50"/>
|
||||
<source>Height</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qrectedit.cpp" line="20"/>
|
||||
<location filename="../qrectedit.cpp" line="51"/>
|
||||
<source>Width</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Shortcuts</name>
|
||||
<message>
|
||||
<location filename="../shortcuts.cpp" line="33"/>
|
||||
<location filename="../shortcuts.cpp" line="49"/>
|
||||
<source>Command</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../shortcuts.cpp" line="33"/>
|
||||
<location filename="../shortcuts.cpp" line="49"/>
|
||||
<source>Shortcut</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>StringListEdit</name>
|
||||
<message>
|
||||
<location filename="../qpiconfigvaluewidget.cpp" line="20"/>
|
||||
<location filename="../qpiconfigvaluewidget.cpp" line="37"/>
|
||||
<source>Add</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigvaluewidget.cpp" line="21"/>
|
||||
<location filename="../qpiconfigvaluewidget.cpp" line="38"/>
|
||||
<source>Remove</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigvaluewidget.cpp" line="22"/>
|
||||
<location filename="../qpiconfigvaluewidget.cpp" line="39"/>
|
||||
<source>Clear</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
69
qad_widgets/lconedlabelplugin.cpp
Normal file
@@ -0,0 +1,69 @@
|
||||
#include "iconedlabel.h"
|
||||
#include "iconedlabelplugin.h"
|
||||
#include <QtCore/QtPlugin>
|
||||
|
||||
|
||||
IconedLabelPlugin::IconedLabelPlugin(QObject * parent): QObject(parent) {
|
||||
m_initialized = false;
|
||||
}
|
||||
|
||||
|
||||
void IconedLabelPlugin::initialize(QDesignerFormEditorInterface * /* core */) {
|
||||
if (m_initialized)
|
||||
return;
|
||||
|
||||
// Add extension registrations, etc. here
|
||||
|
||||
m_initialized = true;
|
||||
}
|
||||
|
||||
|
||||
bool IconedLabelPlugin::isInitialized() const {
|
||||
return m_initialized;
|
||||
}
|
||||
|
||||
|
||||
QWidget * IconedLabelPlugin::createWidget(QWidget * parent) {
|
||||
return new IconedLabel(parent);
|
||||
}
|
||||
|
||||
|
||||
QString IconedLabelPlugin::name() const {
|
||||
return QLatin1String("IconedLabel");
|
||||
}
|
||||
|
||||
|
||||
QString IconedLabelPlugin::group() const {
|
||||
return QLatin1String("Display Widgets");
|
||||
}
|
||||
|
||||
|
||||
QIcon IconedLabelPlugin::icon() const {
|
||||
return QIcon();
|
||||
}
|
||||
|
||||
|
||||
QString IconedLabelPlugin::toolTip() const {
|
||||
return QLatin1String("Label with Icon");
|
||||
}
|
||||
|
||||
|
||||
QString IconedLabelPlugin::whatsThis() const {
|
||||
return QLatin1String("Label with Icon");
|
||||
}
|
||||
|
||||
|
||||
bool IconedLabelPlugin::isContainer() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
QString IconedLabelPlugin::domXml() const {
|
||||
return QLatin1String("<widget class=\"IconedLabel\" name=\"iconedLabel\">\n</widget>\n");
|
||||
}
|
||||
|
||||
|
||||
QString IconedLabelPlugin::includeFile() const {
|
||||
return QLatin1String("iconedlabel.h");
|
||||
}
|
||||
|
||||
1
qad_widgets/make_lib.bat
Normal file
@@ -0,0 +1 @@
|
||||
cmake_mgw -DLIB= && make install && qmake && make install
|
||||
31
qad_widgets/object_script.qad_widgets_plugin
Normal file
@@ -0,0 +1,31 @@
|
||||
INPUT(
|
||||
./qad_widgets.o
|
||||
./spinsliderplugin.o
|
||||
./colorbuttonplugin.o
|
||||
./chardialogplugin.o
|
||||
./shortcutsplugin.o
|
||||
./qipeditplugin.o
|
||||
./clineeditplugin.o
|
||||
./ecomboboxplugin.o
|
||||
./qpointeditplugin.o
|
||||
./qrecteditplugin.o
|
||||
./qpiconsoleplugin.o
|
||||
./lconedlabelplugin.o
|
||||
./qcodeeditplugin.o
|
||||
./qvarianteditplugin.o
|
||||
./moc_qad_widgets.o
|
||||
./moc_spinsliderplugin.o
|
||||
./moc_colorbuttonplugin.o
|
||||
./moc_chardialogplugin.o
|
||||
./moc_shortcutsplugin.o
|
||||
./moc_qipeditplugin.o
|
||||
./moc_clineeditplugin.o
|
||||
./moc_ecomboboxplugin.o
|
||||
./moc_qpointeditplugin.o
|
||||
./moc_qrecteditplugin.o
|
||||
./moc_qpiconsoleplugin.o
|
||||
./moc_iconedlabelplugin.o
|
||||
./moc_qcodeeditplugin.o
|
||||
./moc_qvarianteditplugin.o
|
||||
./qrc_qad_widgets.o
|
||||
);
|
||||
38
qad_widgets/qad_widgets.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
#include "spinsliderplugin.h"
|
||||
#include "colorbuttonplugin.h"
|
||||
#include "chardialogplugin.h"
|
||||
#include "shortcutsplugin.h"
|
||||
#include "clineeditplugin.h"
|
||||
#include "qipeditplugin.h"
|
||||
#include "qpointeditplugin.h"
|
||||
#include "qrecteditplugin.h"
|
||||
#include "ecomboboxplugin.h"
|
||||
#include "qpiconsoleplugin.h"
|
||||
#include "iconedlabelplugin.h"
|
||||
#include "qcodeeditplugin.h"
|
||||
#include "qvarianteditplugin.h"
|
||||
#include "qad_widgets.h"
|
||||
|
||||
QADWidgets::QADWidgets(QObject * parent): QObject(parent)
|
||||
{
|
||||
m_widgets.append(new SpinSliderPlugin(this));
|
||||
m_widgets.append(new ColorButtonPlugin(this));
|
||||
m_widgets.append(new CharDialogPlugin(this));
|
||||
m_widgets.append(new ShortcutsPlugin(this));
|
||||
m_widgets.append(new CLineEditPlugin(this));
|
||||
m_widgets.append(new QIPEditPlugin(this));
|
||||
m_widgets.append(new QPointEditPlugin(this));
|
||||
m_widgets.append(new QRectEditPlugin(this));
|
||||
m_widgets.append(new EComboBoxPlugin(this));
|
||||
m_widgets.append(new QPIConsolePlugin(this));
|
||||
m_widgets.append(new IconedLabelPlugin(this));
|
||||
m_widgets.append(new QCodeEditPlugin(this));
|
||||
m_widgets.append(new QVariantEditPlugin(this));
|
||||
}
|
||||
|
||||
|
||||
QList<QDesignerCustomWidgetInterface * > QADWidgets::customWidgets() const {
|
||||
return m_widgets;
|
||||
}
|
||||
|
||||
Q_EXPORT_PLUGIN2(qad_widgets_plugin, QADWidgets)
|
||||
21
qad_widgets/qad_widgets.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef QAD_WIDGETS_H
|
||||
#define QAD_WIDGETS_H
|
||||
|
||||
#include <QtDesigner/QtDesigner>
|
||||
#include <QtCore/qplugin.h>
|
||||
|
||||
class QADWidgets: public QObject, public QDesignerCustomWidgetCollectionInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(QDesignerCustomWidgetCollectionInterface)
|
||||
|
||||
public:
|
||||
explicit QADWidgets(QObject * parent = 0);
|
||||
virtual QList<QDesignerCustomWidgetInterface * > customWidgets() const;
|
||||
|
||||
private:
|
||||
QList<QDesignerCustomWidgetInterface * > m_widgets;
|
||||
|
||||
};
|
||||
|
||||
#endif // QAD_WIDGETS_H
|
||||
3
qad_widgets/qad_widgets.kdev4
Normal file
@@ -0,0 +1,3 @@
|
||||
[Project]
|
||||
Manager=KDevCMakeManager
|
||||
Name=qad_widgets
|
||||
30
qad_widgets/qad_widgets.pro
Normal file
@@ -0,0 +1,30 @@
|
||||
### eqmake4 was here ###
|
||||
CONFIG += designer plugin release
|
||||
TARGET = $$qtLibraryTarget(qad_widgets_plugin)
|
||||
TEMPLATE = lib
|
||||
|
||||
HEADERS = qad_widgets.h \
|
||||
spinsliderplugin.h colorbuttonplugin.h \
|
||||
chardialogplugin.h shortcutsplugin.h qipeditplugin.h \
|
||||
clineeditplugin.h ecomboboxplugin.h \
|
||||
qpointeditplugin.h qrecteditplugin.h \
|
||||
qpiconsoleplugin.h iconedlabelplugin.h \
|
||||
qcodeeditplugin.h qvarianteditplugin.h
|
||||
SOURCES = qad_widgets.cpp \
|
||||
spinsliderplugin.cpp colorbuttonplugin.cpp \
|
||||
chardialogplugin.cpp shortcutsplugin.cpp qipeditplugin.cpp \
|
||||
clineeditplugin.cpp ecomboboxplugin.cpp \
|
||||
qpointeditplugin.cpp qrecteditplugin.cpp \
|
||||
qpiconsoleplugin.cpp lconedlabelplugin.cpp \
|
||||
qcodeeditplugin.cpp qvarianteditplugin.cpp
|
||||
RESOURCES = qad_widgets.qrc
|
||||
TRANSLATIONS = lang/qad_widgets_ru.ts
|
||||
LIBS += -L. -lqad_widgets
|
||||
QMAKE_CXXFLAGS += -g3
|
||||
QMAKE_CFLAGS += -g3
|
||||
|
||||
target.path = $$[QT_INSTALL_PLUGINS]/designer
|
||||
INSTALLS += target
|
||||
|
||||
CONFIG -= debug_and_release debug
|
||||
CONFIG += release
|
||||
39
qad_widgets/qad_widgets.qrc
Normal file
@@ -0,0 +1,39 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>lang/qad_widgets_ru.ts</file>
|
||||
<file>icons/dialog-close.png</file>
|
||||
<file>icons/edit-clear.png</file>
|
||||
<file>icons/edit-guides.png</file>
|
||||
<file>icons/view-grid.png</file>
|
||||
<file>icons/zoom-fit-best.png</file>
|
||||
<file>icons/configure.png</file>
|
||||
<file>icons/alpha.png</file>
|
||||
<file>icons/document-save.png</file>
|
||||
<file>icons/edit-clear-locationbar-rtl.png</file>
|
||||
<file>icons/edit-find.png</file>
|
||||
<file>icons/list-add.png</file>
|
||||
<file>icons/edit-delete.png</file>
|
||||
<file>icons/item-add.png</file>
|
||||
<file>icons/item.png</file>
|
||||
<file>icons/node-add.png</file>
|
||||
<file>icons/node.png</file>
|
||||
<file>icons/edit-copy.png</file>
|
||||
<file>icons/edit-paste.png</file>
|
||||
<file>icons/expand_s_x.png</file>
|
||||
<file>icons/expand_s_y.png</file>
|
||||
<file>icons/expand_x.png</file>
|
||||
<file>icons/expand_y.png</file>
|
||||
<file>icons/border-line.png</file>
|
||||
<file>icons/legend.png</file>
|
||||
<file>icons/chardialog.png</file>
|
||||
<file>icons/clineedit.png</file>
|
||||
<file>icons/colorbutton.png</file>
|
||||
<file>icons/ecombobox.png</file>
|
||||
<file>icons/qpiconsole.png</file>
|
||||
<file>icons/spinslider.png</file>
|
||||
<file>icons/etabwidget.png</file>
|
||||
<file>icons/qcodeedit.png</file>
|
||||
<file>icons/qvariantedit.png</file>
|
||||
<file>icons/code-word.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
39
qad_widgets/qad_widgets.qrc.depends
Normal file
@@ -0,0 +1,39 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>lang/qad_widgets_ru.ts</file>
|
||||
<file>icons/dialog-close.png</file>
|
||||
<file>icons/edit-clear.png</file>
|
||||
<file>icons/edit-guides.png</file>
|
||||
<file>icons/view-grid.png</file>
|
||||
<file>icons/zoom-fit-best.png</file>
|
||||
<file>icons/configure.png</file>
|
||||
<file>icons/alpha.png</file>
|
||||
<file>icons/document-save.png</file>
|
||||
<file>icons/edit-clear-locationbar-rtl.png</file>
|
||||
<file>icons/edit-find.png</file>
|
||||
<file>icons/list-add.png</file>
|
||||
<file>icons/edit-delete.png</file>
|
||||
<file>icons/item-add.png</file>
|
||||
<file>icons/item.png</file>
|
||||
<file>icons/node-add.png</file>
|
||||
<file>icons/node.png</file>
|
||||
<file>icons/edit-copy.png</file>
|
||||
<file>icons/edit-paste.png</file>
|
||||
<file>icons/expand_s_x.png</file>
|
||||
<file>icons/expand_s_y.png</file>
|
||||
<file>icons/expand_x.png</file>
|
||||
<file>icons/expand_y.png</file>
|
||||
<file>icons/border-line.png</file>
|
||||
<file>icons/legend.png</file>
|
||||
<file>icons/chardialog.png</file>
|
||||
<file>icons/clineedit.png</file>
|
||||
<file>icons/colorbutton.png</file>
|
||||
<file>icons/ecombobox.png</file>
|
||||
<file>icons/qpiconsole.png</file>
|
||||
<file>icons/spinslider.png</file>
|
||||
<file>icons/etabwidget.png</file>
|
||||
<file>icons/qcodeedit.png</file>
|
||||
<file>icons/qvariantedit.png</file>
|
||||
<file>icons/code-word.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
778
qad_widgets/qcodeedit.cpp
Normal file
@@ -0,0 +1,778 @@
|
||||
#include "qcodeedit.h"
|
||||
#include <QLayout>
|
||||
#include <QBoxLayout>
|
||||
#include <QScrollBar>
|
||||
#include <QTextDocument>
|
||||
#include <QTextDocumentFragment>
|
||||
#include <QTextOption>
|
||||
#include <QTextCursor>
|
||||
#include <QTextBlock>
|
||||
#include <QAction>
|
||||
#include <QApplication>
|
||||
#include <QHeaderView>
|
||||
|
||||
|
||||
QCodeEdit::QCodeEdit(QWidget * parent): QWidget(parent) {
|
||||
prev_lc = auto_comp_pl = -1;
|
||||
_ignore_focus_out = false;
|
||||
es_line.format.setBackground(QColor(240, 245, 240));
|
||||
es_line.format.setProperty(QTextFormat::FullWidthSelection, true);
|
||||
completer.setWindowFlags(Qt::Tool | Qt::FramelessWindowHint);
|
||||
completer.setFocusPolicy(Qt::NoFocus);
|
||||
completer.setColumnCount(2);
|
||||
completer.setRootIsDecorated(false);
|
||||
completer.setHeaderHidden(true);
|
||||
completer.installEventFilter(this);
|
||||
completer.header()->setDefaultAlignment(Qt::AlignCenter);
|
||||
completer.header()->setResizeMode(QHeaderView::ResizeToContents);
|
||||
completer.header()->setStretchLastSection(true);
|
||||
//completer.setColumnWidth(0, 180);
|
||||
completer.resize(500, 200);
|
||||
textCode = new QPlainTextEdit();
|
||||
textLines = new QPlainTextEdit();
|
||||
textCode->setFrameShadow(QFrame::Plain);
|
||||
textCode->setFrameShape(QFrame::NoFrame);
|
||||
textCode->setLineWrapMode(QPlainTextEdit::NoWrap);
|
||||
textCode->setTabChangesFocus(false);
|
||||
textCode->installEventFilter(this);
|
||||
textCode->viewport()->installEventFilter(this);
|
||||
textLines->setFrameShadow(QFrame::Plain);
|
||||
textLines->setFrameShape(QFrame::NoFrame);
|
||||
textLines->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
|
||||
textLines->setFocusPolicy(Qt::NoFocus);
|
||||
textLines->setTextInteractionFlags(Qt::NoTextInteraction);
|
||||
textLines->setLineWrapMode(QPlainTextEdit::NoWrap);
|
||||
textLines->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
textLines->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
textLines->viewport()->setAutoFillBackground(false);
|
||||
textLines->viewport()->setCursor(Qt::ArrowCursor);
|
||||
textLines->setFixedWidth(textLines->fontMetrics().width(" "));
|
||||
setLayout(new QBoxLayout(QBoxLayout::BottomToTop));
|
||||
layout()->setContentsMargins(0, 0, 0, 0);
|
||||
QFrame * frame = new QFrame();
|
||||
frame->setFrameShadow(QFrame::Sunken);
|
||||
frame->setFrameShape(QFrame::StyledPanel);
|
||||
frame->setLayout(new QBoxLayout(QBoxLayout::LeftToRight));
|
||||
frame->layout()->setContentsMargins(0, 0, 0, 0);
|
||||
frame->layout()->setSpacing(0);
|
||||
frame->layout()->addWidget(textLines);
|
||||
frame->layout()->addWidget(textCode);
|
||||
layout()->addWidget(frame);
|
||||
|
||||
QAction * a = new QAction(this);
|
||||
a->setShortcut(QKeySequence("Shift+Tab"));
|
||||
a->setShortcutContext(Qt::WidgetShortcut);
|
||||
connect(a, SIGNAL(triggered(bool)), this, SLOT(deindent()));
|
||||
textCode->addAction(a);
|
||||
a = new QAction(this);
|
||||
a->setShortcut(QKeySequence("Ctrl+D"));
|
||||
a->setShortcutContext(Qt::WidgetShortcut);
|
||||
connect(a, SIGNAL(triggered(bool)), this, SLOT(deleteLine()));
|
||||
textCode->addAction(a);
|
||||
frame->setFocusProxy(textCode);
|
||||
QTextOption to = textLines->document()->defaultTextOption();
|
||||
to.setAlignment(Qt::AlignTop | Qt::AlignRight);
|
||||
textLines->document()->setDefaultTextOption(to);
|
||||
setShowSpaces(true);
|
||||
|
||||
connect(&completer, SIGNAL(itemDoubleClicked(QTreeWidgetItem * ,int)), this, SLOT(commitCompletition()));
|
||||
connect(textCode->verticalScrollBar(), SIGNAL(valueChanged(int)), textLines->verticalScrollBar(), SLOT(setValue(int)));
|
||||
connect(textCode, SIGNAL(textChanged()), this, SLOT(updateLines()));
|
||||
connect(textCode, SIGNAL(textChanged()), this, SIGNAL(textChanged()));
|
||||
connect(textCode, SIGNAL(cursorPositionChanged()), this, SLOT(textEdit_cursorPositionChanged()));
|
||||
connect(textCode, SIGNAL(selectionChanged()), this, SLOT(textEdit_selectionChanged()));
|
||||
updateLines();
|
||||
|
||||
registerAutoCompletitionClass(-1, QCodeEdit::Keyword, "Words", QIcon(":/icons/code-word.png"));
|
||||
}
|
||||
|
||||
|
||||
QCodeEdit::~QCodeEdit() {
|
||||
delete textCode;
|
||||
delete textLines;
|
||||
}
|
||||
|
||||
|
||||
int QCodeEdit::skipRange(const QString & s, int pos, QChar oc, QChar cc, QChar sc) {
|
||||
int cnt = 0;
|
||||
bool skip = false;
|
||||
for (int i = pos - 1; i >= 0; --i) {
|
||||
QChar c = s[i];
|
||||
if (skip) {skip = false; continue;}
|
||||
if (c == sc) {skip = true; continue;}
|
||||
if (c == cc) {cnt++; continue;}
|
||||
if (c == oc) {cnt--; if (cnt == 0) return i;}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
int QCodeEdit::skipCWord(const QString & s, int pos) {
|
||||
QChar pc(0), c(0);
|
||||
for (int i = pos - 1; i >= 0; --i) {
|
||||
pc = c;
|
||||
c = s[i];
|
||||
if (c.isLetterOrNumber() || (c.toLatin1() == '_')) continue;
|
||||
if (pc.isLetter() || (pc.toLatin1() == '_')) return i + 1;
|
||||
return -1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
bool QCodeEdit::matchWritten(QString s, QString w) {
|
||||
if (s.isEmpty() || w.isEmpty()) return true;
|
||||
if (s.contains(w, Qt::CaseInsensitive)) return true;
|
||||
int sp(0);
|
||||
for (int i = 0; i < w.size(); ++i, ++sp) {
|
||||
if (sp >= s.size()) return false;
|
||||
QChar wc(w[i].toLower());
|
||||
bool ns = false, bl = true;
|
||||
while (sp < s.size()) {
|
||||
if (ns || s[sp].toAscii() == '_') {
|
||||
if (s[sp].toAscii() == '_') {sp++; bl = false; continue;}
|
||||
if (s[sp].isLower() && bl) {sp++; continue;}
|
||||
if (s[sp].toLower() != wc) return false;
|
||||
}
|
||||
if (s[sp].toLower() == wc) break;
|
||||
ns = true;
|
||||
sp++;
|
||||
}
|
||||
if (sp >= s.size()) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
QChar QCodeEdit::pairChar(QChar c) {
|
||||
switch (c.toLatin1()) {
|
||||
case '\"': return '\"';
|
||||
case '(': return ')';
|
||||
case ')': return '(';
|
||||
case '[': return ']';
|
||||
case ']': return '[';
|
||||
default: break;
|
||||
}
|
||||
return QChar();
|
||||
}
|
||||
|
||||
|
||||
bool QCodeEdit::eventFilter(QObject * o, QEvent * e) {
|
||||
if (o == &completer) {
|
||||
//qDebug() << o << e;
|
||||
if (e->type() == QEvent::WindowActivate)
|
||||
_ignore_focus_out = true;
|
||||
//qDebug() << e;
|
||||
return QWidget::eventFilter(o, e);
|
||||
}
|
||||
if (o == textCode->viewport()) {
|
||||
if (e->type() == QEvent::MouseButtonPress)
|
||||
completer.hide();
|
||||
return QWidget::eventFilter(o, e);
|
||||
}
|
||||
if (o == textCode) {
|
||||
//qDebug() << o << e;
|
||||
QKeyEvent * ke;
|
||||
QChar kc(0);
|
||||
switch (e->type()) {
|
||||
case QEvent::KeyPress:
|
||||
ke = (QKeyEvent * )e;
|
||||
switch (ke->key()) {
|
||||
case Qt::Key_Space:
|
||||
if (ke->modifiers().testFlag(Qt::ControlModifier)) {
|
||||
invokeAutoCompletition(true);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case Qt::Key_Escape:
|
||||
completer.hide();
|
||||
break;
|
||||
case Qt::Key_Up:
|
||||
if (completer.isVisible()) {
|
||||
previousCompletition();
|
||||
return true;
|
||||
}
|
||||
completer.hide();
|
||||
if (ke->modifiers().testFlag(Qt::AltModifier)) {
|
||||
copyLineUp();
|
||||
return true;
|
||||
}
|
||||
if (ke->modifiers().testFlag(Qt::ControlModifier) && ke->modifiers().testFlag(Qt::ShiftModifier)) {
|
||||
moveLineUp();
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case Qt::Key_Down:
|
||||
if (completer.isVisible()) {
|
||||
nextCompletition();
|
||||
return true;
|
||||
}
|
||||
completer.hide();
|
||||
if (ke->modifiers().testFlag(Qt::AltModifier)) {
|
||||
copyLineDown();
|
||||
return true;
|
||||
}
|
||||
if (ke->modifiers().testFlag(Qt::ControlModifier) && ke->modifiers().testFlag(Qt::ShiftModifier)) {
|
||||
moveLineDown();
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case Qt::Key_Home:
|
||||
case Qt::Key_End:
|
||||
case Qt::Key_PageUp:
|
||||
case Qt::Key_PageDown:
|
||||
if (completer.isVisible()) {
|
||||
qApp->sendEvent(&completer, new QKeyEvent(e->type(), ke->key(), ke->modifiers()));
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case Qt::Key_Left:
|
||||
case Qt::Key_Right:
|
||||
case Qt::Key_Backspace:
|
||||
case Qt::Key_Delete:
|
||||
if (completer.isVisible())
|
||||
QMetaObject::invokeMethod(this, "invokeAutoCompletition", Qt::QueuedConnection, Q_ARG(bool, false));
|
||||
break;
|
||||
case Qt::Key_Return:
|
||||
if (completer.isVisible()) {
|
||||
commitCompletition();
|
||||
completer.hide();
|
||||
return true;
|
||||
}
|
||||
if (textCode->textCursor().selectedText().isEmpty())
|
||||
QMetaObject::invokeMethod(this, "autoIndent", Qt::QueuedConnection);
|
||||
break;
|
||||
case Qt::Key_Tab:
|
||||
if (!textCode->textCursor().selectedText().isEmpty()) {
|
||||
if (ke->modifiers().testFlag(Qt::ShiftModifier))
|
||||
deindent();
|
||||
else
|
||||
indent();
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case Qt::Key_D:
|
||||
if (ke->modifiers().testFlag(Qt::ControlModifier)) {
|
||||
completer.hide();
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
if (!ke->text().isEmpty())
|
||||
kc = ke->text()[0];
|
||||
if (kc == '.') {
|
||||
completer.hide();
|
||||
QMetaObject::invokeMethod(this, "invokeAutoCompletition", Qt::QueuedConnection, Q_ARG(bool, false));
|
||||
} else {
|
||||
if ((kc.isLetterOrNumber() || kc.toAscii() == '_') && completer.isVisible())
|
||||
QMetaObject::invokeMethod(this, "invokeAutoCompletition", Qt::QueuedConnection, Q_ARG(bool, false));
|
||||
}
|
||||
break;
|
||||
case QEvent::FocusOut:
|
||||
if (_ignore_focus_out) {
|
||||
_ignore_focus_out = false;
|
||||
break;
|
||||
}
|
||||
case QEvent::Hide:
|
||||
case QEvent::HideToParent:
|
||||
case QEvent::MouseButtonPress:
|
||||
//qDebug() << e;
|
||||
completer.hide();
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
return QWidget::eventFilter(o, e);
|
||||
}
|
||||
|
||||
|
||||
void QCodeEdit::applyExtraSelection() {
|
||||
textCode->setExtraSelections(QList<QTextEdit::ExtraSelection>() << es_line << es_selected << es_custom);
|
||||
}
|
||||
|
||||
|
||||
void QCodeEdit::nextCompletition() {
|
||||
int ci = completer.currentIndex().row();
|
||||
if (ci >= completer.topLevelItemCount() - 1) return;
|
||||
if (completer.topLevelItem(ci + 1)->flags().testFlag(Qt::ItemIsSelectable))
|
||||
completer.setCurrentItem(completer.topLevelItem(ci + 1));
|
||||
else {
|
||||
if (ci >= completer.topLevelItemCount() - 2) return;
|
||||
completer.setCurrentItem(completer.topLevelItem(ci + 2));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void QCodeEdit::previousCompletition() {
|
||||
int ci = completer.currentIndex().row();
|
||||
if (ci <= 0) return;
|
||||
if (completer.topLevelItem(ci - 1)->flags().testFlag(Qt::ItemIsSelectable))
|
||||
completer.setCurrentItem(completer.topLevelItem(ci - 1));
|
||||
else {
|
||||
if (ci <= 1) return;
|
||||
completer.setCurrentItem(completer.topLevelItem(ci - 2));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void QCodeEdit::deleteLine() {
|
||||
QTextCursor tc = textCode->textCursor();
|
||||
tc.movePosition(QTextCursor::EndOfLine);
|
||||
tc.movePosition(QTextCursor::StartOfLine, QTextCursor::KeepAnchor);
|
||||
bool md = true;
|
||||
if (!tc.movePosition(QTextCursor::Left, QTextCursor::KeepAnchor)) {
|
||||
tc.movePosition(QTextCursor::StartOfLine);
|
||||
tc.movePosition(QTextCursor::EndOfLine, QTextCursor::KeepAnchor);
|
||||
tc.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor);
|
||||
md = false;
|
||||
}
|
||||
tc.removeSelectedText();
|
||||
tc.movePosition(QTextCursor::StartOfLine);
|
||||
if (md) tc.movePosition(QTextCursor::Down);
|
||||
textCode->setTextCursor(tc);
|
||||
}
|
||||
|
||||
|
||||
void QCodeEdit::copyLineUp() {
|
||||
QTextCursor tc = textCode->textCursor();
|
||||
int ss = tc.selectionStart(), ss_ = ss, se = tc.selectionEnd(), se_ = se;
|
||||
QString st_ = tc.selection().toPlainText();
|
||||
if (st_.endsWith("\n")) {
|
||||
st_.chop(1);
|
||||
se--; se_--;
|
||||
}
|
||||
tc.setPosition(ss); tc.movePosition(QTextCursor::StartOfLine); ss = tc.position();
|
||||
tc.setPosition(se); tc.movePosition(QTextCursor::EndOfLine); se = tc.position();
|
||||
tc.setPosition(ss); tc.setPosition(se, QTextCursor::KeepAnchor);
|
||||
bool ins_nl = false;
|
||||
if (!tc.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor))
|
||||
ins_nl = true;
|
||||
QString l = tc.selectedText();
|
||||
tc.beginEditBlock();
|
||||
tc.setPosition(ss);
|
||||
if (ins_nl)
|
||||
l.append("\n");
|
||||
tc.insertText(l);
|
||||
tc.setPosition(ss_);
|
||||
tc.setPosition(se_, QTextCursor::KeepAnchor);
|
||||
tc.endEditBlock();
|
||||
textCode->setTextCursor(tc);
|
||||
}
|
||||
|
||||
|
||||
void QCodeEdit::copyLineDown() {
|
||||
QTextCursor tc = textCode->textCursor();
|
||||
int ss = tc.selectionStart(), ss_ = ss, se = tc.selectionEnd(), se_ = se;
|
||||
QString st_ = tc.selection().toPlainText();
|
||||
if (st_.endsWith("\n")) {
|
||||
st_.chop(1);
|
||||
se--; se_--;
|
||||
}
|
||||
tc.setPosition(ss); tc.movePosition(QTextCursor::StartOfLine); ss = tc.position();
|
||||
tc.setPosition(se); tc.movePosition(QTextCursor::EndOfLine); se = tc.position();
|
||||
tc.setPosition(ss); tc.setPosition(se, QTextCursor::KeepAnchor);
|
||||
bool ins_nl = false;
|
||||
if (!tc.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor))
|
||||
ins_nl = true;
|
||||
QString l = tc.selectedText();
|
||||
tc.beginEditBlock();
|
||||
tc.setPosition(ss);
|
||||
ss_ += l.size(); se_ += l.size();
|
||||
if (ins_nl) {
|
||||
l.append("\n");
|
||||
ss_++; se_++;
|
||||
}
|
||||
tc.insertText(l);
|
||||
tc.setPosition(ss_);
|
||||
tc.setPosition(se_, QTextCursor::KeepAnchor);
|
||||
tc.endEditBlock();
|
||||
textCode->setTextCursor(tc);
|
||||
}
|
||||
|
||||
|
||||
void QCodeEdit::moveLineUp() {
|
||||
QTextCursor tc = textCode->textCursor();
|
||||
int ss = tc.selectionStart(), ss_ = ss, se = tc.selectionEnd(), se_ = se;
|
||||
QString st_ = tc.selection().toPlainText();
|
||||
if (st_.endsWith("\n")) {
|
||||
st_.chop(1);
|
||||
se--; se_--;
|
||||
}
|
||||
tc.setPosition(ss); tc.movePosition(QTextCursor::StartOfLine); ss = tc.position();
|
||||
tc.setPosition(se); tc.movePosition(QTextCursor::EndOfLine); se = tc.position();
|
||||
tc.setPosition(ss);
|
||||
if (!tc.movePosition(QTextCursor::Up))
|
||||
return;
|
||||
tc.movePosition(QTextCursor::Down, QTextCursor::KeepAnchor);
|
||||
QString l = tc.selectedText();
|
||||
ss -= l.size(); se -= l.size();
|
||||
ss_ -= l.size(); se_ -= l.size();
|
||||
tc.beginEditBlock();
|
||||
tc.removeSelectedText();
|
||||
tc.setPosition(se);
|
||||
bool de = false;
|
||||
if (!tc.movePosition(QTextCursor::Right)) {
|
||||
l.prepend("\n");
|
||||
de = true;
|
||||
}
|
||||
tc.insertText(l);
|
||||
if (de) {
|
||||
tc.movePosition(QTextCursor::End);
|
||||
tc.movePosition(QTextCursor::Left, QTextCursor::KeepAnchor);
|
||||
tc.removeSelectedText();
|
||||
}
|
||||
tc.setPosition(ss_);
|
||||
tc.setPosition(se_, QTextCursor::KeepAnchor);
|
||||
tc.endEditBlock();
|
||||
textCode->setTextCursor(tc);
|
||||
}
|
||||
|
||||
|
||||
void QCodeEdit::moveLineDown() {
|
||||
QTextCursor tc = textCode->textCursor();
|
||||
int ss = tc.selectionStart(), ss_ = ss, se = tc.selectionEnd(), se_ = se;
|
||||
QString st_ = tc.selection().toPlainText();
|
||||
if (st_.endsWith("\n")) {
|
||||
st_.chop(1);
|
||||
se--; se_--;
|
||||
}
|
||||
tc.setPosition(ss); tc.movePosition(QTextCursor::StartOfLine); ss = tc.position();
|
||||
tc.setPosition(se); tc.movePosition(QTextCursor::EndOfLine); se = tc.position();
|
||||
tc.setPosition(se);
|
||||
if (!tc.movePosition(QTextCursor::Right))
|
||||
return;
|
||||
bool de = false;
|
||||
if (!tc.movePosition(QTextCursor::Down, QTextCursor::KeepAnchor)) {
|
||||
tc.movePosition(QTextCursor::EndOfLine, QTextCursor::KeepAnchor);
|
||||
de = true;
|
||||
}
|
||||
QString l = tc.selectedText();
|
||||
tc.beginEditBlock();
|
||||
tc.removeSelectedText();
|
||||
tc.setPosition(ss);
|
||||
if (de) l += "\n";
|
||||
tc.insertText(l);
|
||||
if (de) {
|
||||
tc.movePosition(QTextCursor::End);
|
||||
tc.movePosition(QTextCursor::Left, QTextCursor::KeepAnchor);
|
||||
tc.removeSelectedText();
|
||||
}
|
||||
ss += l.size(); se += l.size();
|
||||
ss_ += l.size(); se_ += l.size();
|
||||
tc.setPosition(ss_);
|
||||
tc.setPosition(se_, QTextCursor::KeepAnchor);
|
||||
tc.endEditBlock();
|
||||
textCode->setTextCursor(tc);
|
||||
}
|
||||
|
||||
|
||||
void QCodeEdit::indent() {
|
||||
QTextCursor tc = textCode->textCursor();
|
||||
int ss = tc.selectionStart(), ss_ = ss, se = tc.selectionEnd(), se_ = se;
|
||||
QString st_ = tc.selection().toPlainText();
|
||||
if (st_.endsWith("\n")) {
|
||||
st_.chop(1);
|
||||
se--; se_--;
|
||||
}
|
||||
tc.setPosition(ss); tc.movePosition(QTextCursor::StartOfLine); ss = tc.position();
|
||||
tc.setPosition(se); tc.movePosition(QTextCursor::EndOfLine); se = tc.position();
|
||||
tc.setPosition(ss);
|
||||
while (tc.position() < se_) {
|
||||
tc.insertText("\t");
|
||||
se_++;
|
||||
tc.movePosition(QTextCursor::StartOfLine);
|
||||
if (!tc.movePosition(QTextCursor::Down))
|
||||
break;
|
||||
}
|
||||
tc.setPosition(ss_ + 1);
|
||||
tc.setPosition(se_, QTextCursor::KeepAnchor);
|
||||
textCode->setTextCursor(tc);
|
||||
}
|
||||
|
||||
|
||||
void QCodeEdit::deindent() {
|
||||
QTextCursor tc = textCode->textCursor();
|
||||
int ss = tc.selectionStart(), ss_ = ss, se = tc.selectionEnd(), se_ = se;
|
||||
QString st_ = tc.selection().toPlainText();
|
||||
if (st_.endsWith("\n")) {
|
||||
st_.chop(1);
|
||||
se--; se_--;
|
||||
}
|
||||
tc.setPosition(ss); tc.movePosition(QTextCursor::StartOfLine); ss = tc.position();
|
||||
tc.setPosition(se); tc.movePosition(QTextCursor::EndOfLine); se = tc.position();
|
||||
tc.setPosition(ss);
|
||||
bool first = true;
|
||||
while (tc.position() < se_) {
|
||||
tc.movePosition(QTextCursor::StartOfLine);
|
||||
tc.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor);
|
||||
int rs = 0;
|
||||
if (tc.selectedText() == "\t") {
|
||||
tc.removeSelectedText();
|
||||
rs = 1;
|
||||
} else {
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
tc.movePosition(QTextCursor::StartOfLine);
|
||||
tc.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor);
|
||||
if (tc.selectedText() == " ") {
|
||||
tc.removeSelectedText();
|
||||
rs++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (first) {
|
||||
first = false;
|
||||
ss_ -= rs;
|
||||
}
|
||||
se_ -= rs;
|
||||
tc.movePosition(QTextCursor::StartOfLine);
|
||||
if (!tc.movePosition(QTextCursor::Down))
|
||||
break;
|
||||
}
|
||||
tc.setPosition(ss_);
|
||||
tc.setPosition(se_, QTextCursor::KeepAnchor);
|
||||
textCode->setTextCursor(tc);
|
||||
}
|
||||
|
||||
|
||||
void QCodeEdit::autoIndent() {
|
||||
QTextCursor tc = textCode->textCursor(), stc = tc;
|
||||
tc.movePosition(QTextCursor::StartOfLine);
|
||||
if (!tc.movePosition(QTextCursor::Up)) return;
|
||||
tc.movePosition(QTextCursor::Down, QTextCursor::KeepAnchor);
|
||||
QString line = tc.selectedText(), tabs;
|
||||
int i = 0;
|
||||
for (; i < line.size(); ++i)
|
||||
if (!line[i].isSpace()) {
|
||||
tabs = line.left(i);
|
||||
break;
|
||||
}
|
||||
if (i >= line.size())
|
||||
tabs = line.left(line.size() - 1);
|
||||
int nt = qMax<int>(0, line.count(QChar('{')) - line.count(QChar('}')));
|
||||
tabs.append(QString("\t").repeated(nt));
|
||||
if (tabs.isEmpty()) return;
|
||||
stc.insertText(tabs);
|
||||
textCode->setTextCursor(stc);
|
||||
}
|
||||
|
||||
|
||||
void QCodeEdit::updateLines() {
|
||||
textCode->setTabStopWidth(textCode->fontMetrics().width(" "));
|
||||
int lc = textCode->document()->lineCount();
|
||||
if (prev_lc == lc) return;
|
||||
prev_lc = lc;
|
||||
textLines->setFixedWidth(textLines->fontMetrics().width(QString(" %1").arg(lc)));
|
||||
textLines->clear();
|
||||
for (int i = 1; i <= lc; ++i)
|
||||
textLines->appendPlainText(QString("%1").arg(i));
|
||||
textLines->verticalScrollBar()->setValue(textCode->verticalScrollBar()->value());
|
||||
}
|
||||
|
||||
|
||||
QCodeEdit::ACList QCodeEdit::wordsCompletitionList(const QString & written) const {
|
||||
QCodeEdit::ACList ret;
|
||||
if (!written.isEmpty()) {
|
||||
QTextCursor tc = QTextCursor(textCode->document()->begin()), stc;
|
||||
QStringList acwl;
|
||||
tc = QTextCursor(textCode->document()->begin());
|
||||
while (true) {
|
||||
tc = textCode->document()->find(written, tc);
|
||||
if (tc.isNull()) break;
|
||||
stc = tc;
|
||||
stc.movePosition(QTextCursor::Left);
|
||||
stc.select(QTextCursor::WordUnderCursor);
|
||||
if (!stc.selectedText().isEmpty() && stc.selectedText().trimmed() != written)
|
||||
acwl << stc.selectedText();
|
||||
}
|
||||
acwl.removeDuplicates();
|
||||
ACPair acl;
|
||||
acl.first = -1;
|
||||
foreach (const QString & s, acwl)
|
||||
acl.second << StringsPair("", s);
|
||||
ret << acl;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void QCodeEdit::invokeAutoCompletition(bool force) {
|
||||
QTextCursor tc = textCode->textCursor(), stc = tc;
|
||||
if (tc.isNull()) {
|
||||
completer.hide();
|
||||
return;
|
||||
}
|
||||
int line = tc.block().firstLineNumber();
|
||||
if (completer.isVisible()) {
|
||||
if (auto_comp_pl != line) {
|
||||
completer.hide();
|
||||
auto_comp_pl = line;
|
||||
return;
|
||||
}
|
||||
}
|
||||
QString doc = textCode->toPlainText();
|
||||
auto_comp_pl = line;
|
||||
completer.clear();
|
||||
int spos = tc.position(), cpos = spos;
|
||||
tc.movePosition(QTextCursor::Left, QTextCursor::KeepAnchor);
|
||||
QStringList scope;
|
||||
QString written = tc.selectedText().trimmed();
|
||||
//qDebug() << "\n*** invokeAutoCompletition ***";
|
||||
if (written != "_" && !written.leftJustified(1)[0].isLetterOrNumber()) {
|
||||
written.clear();
|
||||
} else {
|
||||
cpos = skipCWord(doc, spos);
|
||||
if (cpos >= 0)
|
||||
written = doc.mid(cpos, spos - cpos).trimmed();
|
||||
}
|
||||
while (cpos >= 0) {
|
||||
cpos--;
|
||||
//qDebug() << "char =" << doc.mid(cpos, 1);
|
||||
if (doc.mid(cpos, 1) != ".") break;
|
||||
QChar c = doc.mid(cpos - 1, 1).leftJustified(1)[0];
|
||||
int ppos = cpos;
|
||||
if (c == '\"' || c == ')' || c == ']') {
|
||||
cpos = skipRange(doc, cpos, pairChar(c), c, '\\');
|
||||
//qDebug() << "range" << cpos;
|
||||
if (cpos < 0) break;
|
||||
}
|
||||
int npos = skipCWord(doc, cpos);
|
||||
if (npos < 0) break;
|
||||
scope.push_front(doc.mid(npos, ppos - npos));
|
||||
cpos = npos;
|
||||
}
|
||||
ACList acl(autoCompletitionList(scope, written));
|
||||
//qDebug() << written << scope << acl.size();
|
||||
if (scope.isEmpty() && written.isEmpty() && !force) {
|
||||
completer.hide();
|
||||
return;
|
||||
}
|
||||
acl << wordsCompletitionList(written);
|
||||
QFont bf(font());
|
||||
bf.setBold(true);
|
||||
foreach (const ACPair & ac, acl) {
|
||||
if (ac.second.isEmpty()) continue;
|
||||
ACClass acc = ac_classes.value(ac.first);
|
||||
QTreeWidgetItem * gi = new QTreeWidgetItem();
|
||||
gi->setText(0, acc.name);
|
||||
gi->setTextAlignment(0, Qt::AlignCenter);
|
||||
gi->setTextAlignment(1, Qt::AlignCenter);
|
||||
gi->setFont(0, bf);
|
||||
gi->setBackgroundColor(0, Qt::lightGray);
|
||||
gi->setFlags(Qt::ItemIsEnabled);
|
||||
completer.addTopLevelItem(gi);
|
||||
gi->setFirstColumnSpanned(true);
|
||||
foreach (const StringsPair & s, ac.second) {
|
||||
QTreeWidgetItem * ni = new QTreeWidgetItem();
|
||||
ni->setIcon(0, acc.icon);
|
||||
ni->setText(0, s.first);
|
||||
ni->setText(1, s.second);
|
||||
completer.addTopLevelItem(ni);
|
||||
}
|
||||
}
|
||||
if (completer.topLevelItemCount() > 1)
|
||||
completer.setCurrentItem(completer.topLevelItem(1));
|
||||
if (completer.isHidden())
|
||||
completer.move(textCode->mapToGlobal(textCode->cursorRect().bottomRight()));
|
||||
completer.setVisible(completer.topLevelItemCount() > 0);
|
||||
}
|
||||
|
||||
|
||||
void QCodeEdit::commitCompletition() {
|
||||
if (completer.currentItem() == 0) return;
|
||||
if (!completer.currentItem()->flags().testFlag(Qt::ItemIsSelectable)) return;
|
||||
QString ins = completer.currentItem()->text(1), ret = completer.currentItem()->text(0);
|
||||
QTextCursor tc = textCode->textCursor(), stc = tc;
|
||||
tc.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor);
|
||||
bool ins_br = true, shifted = false;
|
||||
if (!tc.selectedText().isEmpty()) {
|
||||
if (!tc.selectedText()[0].isLetterOrNumber() && !tc.selectedText()[0].isSpace()) {
|
||||
stc.movePosition(QTextCursor::Left);
|
||||
shifted = true;
|
||||
} else {
|
||||
tc.movePosition(QTextCursor::Left);
|
||||
tc.movePosition(QTextCursor::EndOfWord);
|
||||
tc.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor);
|
||||
}
|
||||
if (!tc.selectedText().isEmpty())
|
||||
if (tc.selectedText()[0].toAscii() == '(')
|
||||
ins_br = false;
|
||||
}
|
||||
if (ins.contains("("))
|
||||
ins = ins.left(ins.indexOf("(")) + "()";
|
||||
if (!ins_br && ins.endsWith("()"))
|
||||
ins.chop(2);
|
||||
tc = stc;
|
||||
tc.select(QTextCursor::WordUnderCursor);
|
||||
if (!tc.selectedText().leftJustified(1)[0].isLetterOrNumber()) {
|
||||
tc = stc;
|
||||
if (shifted)
|
||||
tc.movePosition(QTextCursor::Right);
|
||||
}
|
||||
textCode->setTextCursor(tc);
|
||||
textCode->textCursor().insertText(ins);
|
||||
tc = textCode->textCursor();
|
||||
if (ins_br) {
|
||||
if (ret == "void") {
|
||||
tc.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor);
|
||||
if (tc.selectedText() != ";") {
|
||||
textCode->textCursor().insertText(";");
|
||||
tc.movePosition(QTextCursor::Left, QTextCursor::MoveAnchor, 2);
|
||||
}
|
||||
}
|
||||
if (ins.endsWith(")") && !completer.currentItem()->text(1).endsWith("()")) {
|
||||
tc.movePosition(QTextCursor::Left);
|
||||
textCode->setTextCursor(tc);
|
||||
}
|
||||
} else {
|
||||
if (completer.currentItem()->text(1).endsWith(")")) {
|
||||
tc.movePosition(QTextCursor::Right);
|
||||
textCode->setTextCursor(tc);
|
||||
}
|
||||
if (completer.currentItem()->text(1).endsWith("()")) {
|
||||
tc.movePosition(QTextCursor::Right);
|
||||
textCode->setTextCursor(tc);
|
||||
}
|
||||
}
|
||||
completer.hide();
|
||||
}
|
||||
|
||||
|
||||
void QCodeEdit::textEdit_cursorPositionChanged() {
|
||||
es_line.cursor = textCode->textCursor();
|
||||
es_line.cursor.select(QTextCursor::LineUnderCursor);
|
||||
es_line.cursor.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor);
|
||||
applyExtraSelection();
|
||||
}
|
||||
|
||||
|
||||
void QCodeEdit::textEdit_textChanged() {
|
||||
updateLines();
|
||||
}
|
||||
|
||||
|
||||
void QCodeEdit::textEdit_selectionChanged() {
|
||||
es_selected.clear();
|
||||
QString sf = textCode->textCursor().selectedText();
|
||||
if (sf.trimmed().isEmpty() || sf.contains("\n")) {
|
||||
applyExtraSelection();
|
||||
return;
|
||||
}
|
||||
QTextCursor tc(textCode->document()->begin());
|
||||
QTextEdit::ExtraSelection es;
|
||||
es.format.setBackground(QColor(251, 250, 150));
|
||||
while (true) {
|
||||
tc = textCode->document()->find(sf, tc, QTextDocument::FindCaseSensitively | QTextDocument::FindWholeWords);
|
||||
if (tc.isNull()) break;
|
||||
es.cursor = tc;
|
||||
es_selected << es;
|
||||
}
|
||||
applyExtraSelection();
|
||||
}
|
||||
|
||||
|
||||
void QCodeEdit::setShowSpaces(bool yes) {
|
||||
spaces_ = yes;
|
||||
QTextOption to = textCode->document()->defaultTextOption();
|
||||
to.setFlags(yes ? QTextOption::ShowTabsAndSpaces : (QTextOption::Flags)0);
|
||||
textCode->document()->setDefaultTextOption(to);
|
||||
}
|
||||
113
qad_widgets/qcodeedit.h
Normal file
@@ -0,0 +1,113 @@
|
||||
#ifndef QCODEEDIT_H
|
||||
#define QCODEEDIT_H
|
||||
|
||||
#include <QDebug>
|
||||
#include <QPlainTextEdit>
|
||||
#include <QTreeWidget>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QCodeEdit: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString text READ text WRITE setText)
|
||||
Q_PROPERTY(bool showSpaces READ showSpaces WRITE setShowSpaces)
|
||||
Q_PROPERTY(bool showLineNumbers READ showLineNumbers WRITE setShowLineNumbers)
|
||||
|
||||
public:
|
||||
QCodeEdit(QWidget * parent = 0);
|
||||
~QCodeEdit();
|
||||
|
||||
enum ACClassType {
|
||||
Keyword,
|
||||
Function,
|
||||
Namespace
|
||||
};
|
||||
|
||||
QTextCursor textCursor() const {return textCode->textCursor();}
|
||||
QTextDocument * document() const {return textCode->document();}
|
||||
void setTextCursor(const QTextCursor & c) {textCode->setTextCursor(c);}
|
||||
void centerCursor() {textCode->centerCursor(); updateLines();}
|
||||
void insertText(const QString & text) {textCode->insertPlainText(text); updateLines();}
|
||||
void appendText(const QString & text) {textCode->appendPlainText(text); updateLines();}
|
||||
void setCustomExtraSelection(const QList<QTextEdit::ExtraSelection> & es) {es_custom = es; applyExtraSelection();}
|
||||
QRect cursorRect() const {return textCode->cursorRect();}
|
||||
QRect cursorRect(const QTextCursor & cursor) const {return textCode->cursorRect(cursor);}
|
||||
QString text() const {return textCode->toPlainText();}
|
||||
bool showSpaces() const {return spaces_;}
|
||||
bool showLineNumbers() const {return textLines->isVisible();}
|
||||
|
||||
QPlainTextEdit * textEdit() const {return textCode;}
|
||||
|
||||
void registerAutoCompletitionClass(int id, ACClassType ac_class, const QString & name, const QIcon & icon = QIcon()) {ac_classes[id] = ACClass(id, ac_class, name, icon);}
|
||||
|
||||
protected:
|
||||
typedef QPair<QString, QString> StringsPair;
|
||||
typedef QPair<int, QList<StringsPair> > ACPair;
|
||||
typedef QList<ACPair> ACList;
|
||||
|
||||
virtual ACList autoCompletitionList(const QStringList & scope, const QString & written) const {return ACList();}
|
||||
ACList wordsCompletitionList(const QString & written) const;
|
||||
static int skipRange(const QString & s, int pos, QChar oc, QChar cc, QChar sc = QChar());
|
||||
static int skipCWord(const QString & s, int pos);
|
||||
static bool matchWritten(QString s, QString w);
|
||||
static QChar pairChar(QChar c);
|
||||
|
||||
private:
|
||||
struct ACClass {
|
||||
ACClass(int i = -2, ACClassType c = QCodeEdit::Keyword, const QString & n = QString(), const QIcon & ic = QIcon()): id(i), class_(c), name(n), icon(ic) {}
|
||||
int id;
|
||||
ACClassType class_;
|
||||
QString name;
|
||||
QIcon icon;
|
||||
};
|
||||
|
||||
QPlainTextEdit * textCode, * textLines;
|
||||
QTreeWidget completer;
|
||||
QTextEdit::ExtraSelection es_line;
|
||||
QList<QTextEdit::ExtraSelection> es_selected, es_custom;
|
||||
QMap<int, ACClass> ac_classes;
|
||||
int prev_lc, auto_comp_pl;
|
||||
bool spaces_, _ignore_focus_out;
|
||||
|
||||
bool eventFilter(QObject * o, QEvent * e);
|
||||
void applyExtraSelection();
|
||||
void nextCompletition();
|
||||
void previousCompletition();
|
||||
|
||||
private slots:
|
||||
void deleteLine();
|
||||
void copyLineUp();
|
||||
void copyLineDown();
|
||||
void moveLineUp();
|
||||
void moveLineDown();
|
||||
void indent();
|
||||
void deindent();
|
||||
void autoIndent();
|
||||
void updateLines();
|
||||
void invokeAutoCompletition(bool force = false);
|
||||
void commitCompletition();
|
||||
void textEdit_cursorPositionChanged();
|
||||
void textEdit_textChanged();
|
||||
void textEdit_selectionChanged();
|
||||
|
||||
public slots:
|
||||
void setFocus() {textCode->setFocus();}
|
||||
void setText(const QString & t) {textCode->setPlainText(t);}
|
||||
void setShowSpaces(bool yes);
|
||||
void setShowLineNumbers(bool yes) {textLines->setVisible(yes);}
|
||||
|
||||
signals:
|
||||
void textChanged();
|
||||
|
||||
};
|
||||
|
||||
//Q_DECLARE_OPERATORS_FOR_FLAGS(QPIConsole::Formats)
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // QCODEEDIT_H
|
||||
69
qad_widgets/qcodeeditplugin.cpp
Normal file
@@ -0,0 +1,69 @@
|
||||
#include "qcodeedit.h"
|
||||
#include "qcodeeditplugin.h"
|
||||
#include <QtCore/QtPlugin>
|
||||
|
||||
|
||||
QCodeEditPlugin::QCodeEditPlugin(QObject * parent): QObject(parent) {
|
||||
m_initialized = false;
|
||||
}
|
||||
|
||||
|
||||
void QCodeEditPlugin::initialize(QDesignerFormEditorInterface * /* core */) {
|
||||
if (m_initialized)
|
||||
return;
|
||||
|
||||
// Add extension registrations, etc. here
|
||||
|
||||
m_initialized = true;
|
||||
}
|
||||
|
||||
|
||||
bool QCodeEditPlugin::isInitialized() const {
|
||||
return m_initialized;
|
||||
}
|
||||
|
||||
|
||||
QWidget * QCodeEditPlugin::createWidget(QWidget * parent) {
|
||||
return new QCodeEdit(parent);
|
||||
}
|
||||
|
||||
|
||||
QString QCodeEditPlugin::name() const {
|
||||
return QLatin1String("QCodeEdit");
|
||||
}
|
||||
|
||||
|
||||
QString QCodeEditPlugin::group() const {
|
||||
return QLatin1String("Input Widgets");
|
||||
}
|
||||
|
||||
|
||||
QIcon QCodeEditPlugin::icon() const {
|
||||
return QIcon(":/icons/qcodeedit.png");
|
||||
}
|
||||
|
||||
|
||||
QString QCodeEditPlugin::toolTip() const {
|
||||
return QLatin1String("QCodeEdit");
|
||||
}
|
||||
|
||||
|
||||
QString QCodeEditPlugin::whatsThis() const {
|
||||
return QLatin1String("QCodeEdit");
|
||||
}
|
||||
|
||||
|
||||
bool QCodeEditPlugin::isContainer() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
QString QCodeEditPlugin::domXml() const {
|
||||
return QLatin1String("<widget class=\"QCodeEdit\" name=\"codeEdit\">\n</widget>\n");
|
||||
}
|
||||
|
||||
|
||||
QString QCodeEditPlugin::includeFile() const {
|
||||
return QLatin1String("qcodeedit.h");
|
||||
}
|
||||
|
||||
31
qad_widgets/qcodeeditplugin.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef QCODEEDITPLUGIN_H
|
||||
#define QCODEEDITPLUGIN_H
|
||||
|
||||
#include <QDesignerCustomWidgetInterface>
|
||||
|
||||
class QCodeEditPlugin: public QObject, public QDesignerCustomWidgetInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(QDesignerCustomWidgetInterface)
|
||||
|
||||
public:
|
||||
QCodeEditPlugin(QObject * parent = 0);
|
||||
|
||||
bool isContainer() const;
|
||||
bool isInitialized() const;
|
||||
QIcon icon() const;
|
||||
QString domXml() const;
|
||||
QString group() const;
|
||||
QString includeFile() const;
|
||||
QString name() const;
|
||||
QString toolTip() const;
|
||||
QString whatsThis() const;
|
||||
QWidget * createWidget(QWidget * parent);
|
||||
void initialize(QDesignerFormEditorInterface * core);
|
||||
|
||||
private:
|
||||
bool m_initialized;
|
||||
|
||||
};
|
||||
|
||||
#endif // QCODEEDITPLUGIN_H
|
||||
82
qad_widgets/qipedit.cpp
Normal file
@@ -0,0 +1,82 @@
|
||||
#include "qipedit.h"
|
||||
|
||||
QIPEdit::QIPEdit(QWidget * parent, const QString & ip): QWidget(parent) {
|
||||
layout = new QBoxLayout(QBoxLayout::LeftToRight, this);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->setSpacing(1);
|
||||
QIntValidator * validator = new QIntValidator(0, 255, this);
|
||||
for (int i = 0; i < 4; i++) {
|
||||
edits.push_back(new QLineEdit(this));
|
||||
edits.back()->setAlignment(Qt::AlignHCenter);
|
||||
edits.back()->setMaxLength(3);
|
||||
edits.back()->setValidator(validator);
|
||||
edits.back()->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||
layout->addWidget(edits.back());
|
||||
if (i < 3) {
|
||||
dots.push_back(new QLabel(this));
|
||||
dots.back()->setText(".");
|
||||
dots.back()->adjustSize();
|
||||
layout->addWidget(dots.back());
|
||||
}
|
||||
}
|
||||
//for (int i = 0; i < 3; i++) edits[i]->setTabOrder(edits[i+1], edits[i]);
|
||||
connect(edits[0], SIGNAL(returnPressed()), this, SLOT(returnPressed0()));
|
||||
connect(edits[1], SIGNAL(returnPressed()), this, SLOT(returnPressed1()));
|
||||
connect(edits[2], SIGNAL(returnPressed()), this, SLOT(returnPressed2()));
|
||||
connect(edits[3], SIGNAL(returnPressed()), this, SLOT(returnPressed3()));
|
||||
connect(edits[0], SIGNAL(textChanged(const QString & )), this, SLOT(textChanged0(const QString & )));
|
||||
connect(edits[1], SIGNAL(textChanged(const QString & )), this, SLOT(textChanged1(const QString & )));
|
||||
connect(edits[2], SIGNAL(textChanged(const QString & )), this, SLOT(textChanged2(const QString & )));
|
||||
connect(edits[3], SIGNAL(textChanged(const QString & )), this, SLOT(textChanged3(const QString & )));
|
||||
setLayout(layout);
|
||||
setIP(ip);
|
||||
cind = 0;
|
||||
}
|
||||
|
||||
|
||||
QIPEdit::~QIPEdit() {
|
||||
foreach (QLineEdit * i, edits)
|
||||
delete i;
|
||||
foreach (QLabel * i, dots)
|
||||
delete i;
|
||||
edits.clear();
|
||||
dots.clear();
|
||||
delete layout;
|
||||
}
|
||||
|
||||
|
||||
void QIPEdit::setIP(const QString & text) {
|
||||
QString s, str = text;
|
||||
s = str.left(str.indexOf('.'));
|
||||
edits[0]->setText(s == "" ? "0" : s);
|
||||
str = str.right(str.length() - s.length() - 1);
|
||||
s = str.left(str.indexOf('.'));
|
||||
edits[1]->setText(s == "" ? "0" : s);
|
||||
str = str.right(str.length() - s.length() - 1);
|
||||
s = str.left(str.indexOf('.'));
|
||||
edits[2]->setText(s == "" ? "0" : s);
|
||||
str = str.right(str.length() - s.length() - 1);
|
||||
edits[3]->setText(str == "" ? "0" : str);
|
||||
}
|
||||
|
||||
|
||||
QString QIPEdit::IP() {
|
||||
QString s;
|
||||
if (edits[0]->text() == "") s = "0.";
|
||||
else s = edits[0]->text() + ".";
|
||||
if (edits[1]->text() == "") s += "0.";
|
||||
else s += edits[1]->text() + ".";
|
||||
if (edits[2]->text() == "") s += "0.";
|
||||
else s += edits[2]->text() + ".";
|
||||
if (edits[3]->text() == "") s += "0";
|
||||
else s += edits[3]->text();
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
void QIPEdit::returnPress(int index) {
|
||||
if (index < 3) {
|
||||
edits[index + 1]->setFocus();
|
||||
edits[index + 1]->setSelection(0, 3);
|
||||
}
|
||||
}
|
||||
48
qad_widgets/qipedit.h
Normal file
@@ -0,0 +1,48 @@
|
||||
#ifndef QIPEDIT_H
|
||||
#define QIPEDIT_H
|
||||
|
||||
#include <QVector>
|
||||
#include <QBoxLayout>
|
||||
#include <QIntValidator>
|
||||
#include <QFocusEvent>
|
||||
#include <QLineEdit>
|
||||
#include <QLabel>
|
||||
|
||||
class QIPEdit: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString IP READ IP WRITE setIP)
|
||||
|
||||
public:
|
||||
QIPEdit(QWidget * parent = 0, const QString & ip = "");
|
||||
~QIPEdit();
|
||||
|
||||
QString IP();
|
||||
|
||||
private:
|
||||
void returnPress(int index);
|
||||
inline void textChange(int index, const QString & text) {if (text.length() == 3 && isVisible()) returnPress(index); emit valueChanged(IP());}
|
||||
|
||||
int cind;
|
||||
QBoxLayout * layout;
|
||||
QVector<QLineEdit * > edits;
|
||||
QVector<QLabel * > dots;
|
||||
|
||||
public slots:
|
||||
void setIP(const QString & text);
|
||||
|
||||
private slots:
|
||||
void returnPressed0() {returnPress(0);}
|
||||
void returnPressed1() {returnPress(1);}
|
||||
void returnPressed2() {returnPress(2);}
|
||||
void returnPressed3() {returnPress(3);}
|
||||
void textChanged0(const QString & text) {textChange(0, text);}
|
||||
void textChanged1(const QString & text) {textChange(1, text);}
|
||||
void textChanged2(const QString & text) {textChange(2, text);}
|
||||
void textChanged3(const QString & text) {textChange(3, text);}
|
||||
|
||||
signals:
|
||||
void valueChanged(QString);
|
||||
};
|
||||
|
||||
#endif // QIPEDIT_H
|
||||
69
qad_widgets/qipeditplugin.cpp
Normal file
@@ -0,0 +1,69 @@
|
||||
#include "qipedit.h"
|
||||
#include "qipeditplugin.h"
|
||||
#include <QtCore/QtPlugin>
|
||||
|
||||
|
||||
QIPEditPlugin::QIPEditPlugin(QObject * parent): QObject(parent) {
|
||||
m_initialized = false;
|
||||
}
|
||||
|
||||
|
||||
void QIPEditPlugin::initialize(QDesignerFormEditorInterface * /* core */) {
|
||||
if (m_initialized)
|
||||
return;
|
||||
|
||||
// Add extension registrations, etc. here
|
||||
|
||||
m_initialized = true;
|
||||
}
|
||||
|
||||
|
||||
bool QIPEditPlugin::isInitialized() const {
|
||||
return m_initialized;
|
||||
}
|
||||
|
||||
|
||||
QWidget * QIPEditPlugin::createWidget(QWidget * parent) {
|
||||
return new QIPEdit(parent);
|
||||
}
|
||||
|
||||
|
||||
QString QIPEditPlugin::name() const {
|
||||
return QLatin1String("QIPEdit");
|
||||
}
|
||||
|
||||
|
||||
QString QIPEditPlugin::group() const {
|
||||
return QLatin1String("Input Widgets");
|
||||
}
|
||||
|
||||
|
||||
QIcon QIPEditPlugin::icon() const {
|
||||
return QIcon();
|
||||
}
|
||||
|
||||
|
||||
QString QIPEditPlugin::toolTip() const {
|
||||
return QLatin1String("IP Edit");
|
||||
}
|
||||
|
||||
|
||||
QString QIPEditPlugin::whatsThis() const {
|
||||
return QLatin1String("IP Edit");
|
||||
}
|
||||
|
||||
|
||||
bool QIPEditPlugin::isContainer() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
QString QIPEditPlugin::domXml() const {
|
||||
return QLatin1String("<widget class=\"QIPEdit\" name=\"ipEdit\">\n</widget>\n");
|
||||
}
|
||||
|
||||
|
||||
QString QIPEditPlugin::includeFile() const {
|
||||
return QLatin1String("qipedit.h");
|
||||
}
|
||||
|
||||
31
qad_widgets/qipeditplugin.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef QIPEDITPLUGIN_H
|
||||
#define QIPEDITPLUGIN_H
|
||||
|
||||
#include <QDesignerCustomWidgetInterface>
|
||||
|
||||
class QIPEditPlugin: public QObject, public QDesignerCustomWidgetInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(QDesignerCustomWidgetInterface)
|
||||
|
||||
public:
|
||||
QIPEditPlugin(QObject * parent = 0);
|
||||
|
||||
bool isContainer() const;
|
||||
bool isInitialized() const;
|
||||
QIcon icon() const;
|
||||
QString domXml() const;
|
||||
QString group() const;
|
||||
QString includeFile() const;
|
||||
QString name() const;
|
||||
QString toolTip() const;
|
||||
QString whatsThis() const;
|
||||
QWidget * createWidget(QWidget * parent);
|
||||
void initialize(QDesignerFormEditorInterface * core);
|
||||
|
||||
private:
|
||||
bool m_initialized;
|
||||
|
||||
};
|
||||
|
||||
#endif // QIPEDITPLUGIN_H
|
||||
268
qad_widgets/qpiconsole.cpp
Normal file
@@ -0,0 +1,268 @@
|
||||
#include "qpiconsole.h"
|
||||
|
||||
|
||||
QPIConsole::QPIConsole(QWidget * parent): QTabWidget(parent) {
|
||||
connect(this, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int)));
|
||||
cur_tab = timer = -1;
|
||||
def_align = Qt::AlignCenter;
|
||||
}
|
||||
|
||||
|
||||
void QPIConsole::timerEvent(QTimerEvent * ) {
|
||||
for (int i = 0; i < columns().size(); ++i) {
|
||||
Column & ccol(tabs[cur_tab].columns[i]);
|
||||
QVector<Variable> & cvars(ccol.variables);
|
||||
if (ccol.alignment.testFlag(Qt::AlignLeft)) {
|
||||
ccol.layout->setLabelAlignment(Qt::AlignLeft);
|
||||
} else {
|
||||
ccol.layout->setLabelAlignment(Qt::AlignRight);
|
||||
}
|
||||
for (int j = 0; j < cvars.size(); ++j) {
|
||||
Variable & tv(cvars[j]);
|
||||
tv.label->setText(tv.name);
|
||||
if (tv.type >= 0) {
|
||||
if (ccol.alignment.testFlag(Qt::AlignLeft)) {
|
||||
tv.label->setAlignment(Qt::AlignLeft);
|
||||
if (tv.widget != 0) tv.widget->setAlignment(Qt::AlignLeft);
|
||||
} else {
|
||||
if (ccol.alignment.testFlag(Qt::AlignRight)) {
|
||||
tv.label->setAlignment(Qt::AlignRight);
|
||||
if (tv.widget != 0) tv.widget->setAlignment(Qt::AlignRight);
|
||||
} else {
|
||||
tv.label->setAlignment(Qt::AlignRight);
|
||||
if (tv.widget != 0) tv.widget->setAlignment(Qt::AlignLeft);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (tv.widget == 0) continue;
|
||||
if (tv.type <= 0 && tv.ptr == 0) continue;
|
||||
if (tv.ptr != 0) {
|
||||
switch (tv.type) {
|
||||
case 0: tv.widget->setText((tv.ptr != 0 ? *(const QString*)tv.ptr : QString())); break;
|
||||
case 1: tv.widget->setText((tv.ptr != 0 ? *(const bool*)tv.ptr : false) ? "true" : "false"); break;
|
||||
case 2: tv.widget->setText(numIntString<int>(tv.ptr != 0 ? *(const int*)tv.ptr : 0, tv.format)); break;
|
||||
case 3: tv.widget->setText(numIntString<long>(tv.ptr != 0 ? *(const long*)tv.ptr : 0l, tv.format)); break;
|
||||
case 4: tv.widget->setText(QString(tv.ptr != 0 ? *(const char*)tv.ptr : char(0))); break;
|
||||
case 5: tv.widget->setText(numFloatString<float>(tv.ptr != 0 ? *(const float*)tv.ptr : 0.f, tv.format)); break;
|
||||
case 6: tv.widget->setText(numFloatString<double>(tv.ptr != 0 ? *(const double*)tv.ptr : 0., tv.format)); break;
|
||||
case 7: tv.widget->setText(numFloatString<short>(tv.ptr != 0 ? *(const short*)tv.ptr : short(0), tv.format)); break;
|
||||
case 8: tv.widget->setText(numIntString<uint>(tv.ptr != 0 ? *(const uint*)tv.ptr : 0u, tv.format)); break;
|
||||
case 9: tv.widget->setText(numIntString<ulong>(tv.ptr != 0 ? *(const ulong*)tv.ptr : 0ul, tv.format)); break;
|
||||
case 10: tv.widget->setText(numIntString<ushort>(tv.ptr != 0 ? *(const ushort*)tv.ptr : ushort(0), tv.format)); break;
|
||||
case 11: tv.widget->setText(numIntString<uchar>(tv.ptr != 0 ? *(const uchar*)tv.ptr : uchar(0), tv.format)); break;
|
||||
case 12: tv.widget->setText(numIntString<llong>(tv.ptr != 0 ? *(const llong*)tv.ptr : 0l, tv.format)); break;
|
||||
case 13: tv.widget->setText(numIntString<ullong>(tv.ptr != 0 ? *(const ullong*)tv.ptr: 0ull, tv.format)); break;
|
||||
case 14: tv.widget->setText(numIntString<int>(bitsValue(tv.ptr, tv.bitFrom, tv.bitCount), tv.format, tv.bitCount/8)); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#define ADD_VAR_BODY tv.name = name; if (!tv.name.isEmpty()) tv.name += ":"; tv.bitFrom = tv.bitCount = 0; tv.format = format; checkColumn(col);
|
||||
#define ADD_VAR_SBODY tv.name = name; tv.bitFrom = tv.bitCount = 0; tv.format = format; checkColumn(col);
|
||||
|
||||
#define ADD_VAR_QT QLabel * lbl = new QLabel(name); QLabel * w = new QLabel(); \
|
||||
lbl->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); \
|
||||
w->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); \
|
||||
column(col).variables.back().label = lbl; column(col).variables.back().widget = w; \
|
||||
lbl->setAlignment(column(col).alignment); \
|
||||
applyFormat(lbl, format); applyFormat(w, format); \
|
||||
column(col).layout->addRow(lbl, w);
|
||||
|
||||
void QPIConsole::addString(const QString & name, int col, Formats format) {
|
||||
ADD_VAR_SBODY tv.type = -1; tv.ptr = 0; column(col).push_back(tv);
|
||||
QLabel * lbl = new QLabel(name);
|
||||
lbl->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||
column(col).variables.back().label = lbl; column(col).variables.back().widget = 0;
|
||||
lbl->setAlignment(column(col).alignment);
|
||||
applyFormat(lbl, format);
|
||||
column(col).layout->addRow(lbl);
|
||||
}
|
||||
void QPIConsole::addVariable(const QString & name, const QString* ptr, int col, Formats format) {
|
||||
ADD_VAR_BODY tv.type = 0; tv.ptr = ptr; column(col).push_back(tv); ADD_VAR_QT}
|
||||
void QPIConsole::addVariable(const QString & name, const bool * ptr, int col, Formats format) {
|
||||
ADD_VAR_BODY tv.type = 1; tv.ptr = ptr; column(col).push_back(tv); ADD_VAR_QT}
|
||||
void QPIConsole::addVariable(const QString & name, const int * ptr, int col, Formats format) {
|
||||
ADD_VAR_BODY tv.type = 2; tv.ptr = ptr; column(col).push_back(tv); ADD_VAR_QT}
|
||||
void QPIConsole::addVariable(const QString & name, const long * ptr, int col, Formats format) {
|
||||
ADD_VAR_BODY tv.type = 3; tv.ptr = ptr; column(col).push_back(tv); ADD_VAR_QT}
|
||||
void QPIConsole::addVariable(const QString & name, const char * ptr, int col, Formats format) {
|
||||
ADD_VAR_BODY tv.type = 4; tv.ptr = ptr; column(col).push_back(tv); ADD_VAR_QT}
|
||||
void QPIConsole::addVariable(const QString & name, const float * ptr, int col, Formats format) {
|
||||
ADD_VAR_BODY tv.type = 5; tv.ptr = ptr; column(col).push_back(tv); ADD_VAR_QT}
|
||||
void QPIConsole::addVariable(const QString & name, const double * ptr, int col, Formats format) {
|
||||
ADD_VAR_BODY tv.type = 6; tv.ptr = ptr; column(col).push_back(tv); ADD_VAR_QT}
|
||||
void QPIConsole::addVariable(const QString & name, const short * ptr, int col, Formats format) {
|
||||
ADD_VAR_BODY tv.type = 7; tv.ptr = ptr; column(col).push_back(tv); ADD_VAR_QT}
|
||||
void QPIConsole::addVariable(const QString & name, const uint * ptr, int col, Formats format) {
|
||||
ADD_VAR_BODY tv.type = 8; tv.ptr = ptr; column(col).push_back(tv); ADD_VAR_QT}
|
||||
void QPIConsole::addVariable(const QString & name, const ulong * ptr, int col, Formats format) {
|
||||
ADD_VAR_BODY tv.type = 9; tv.ptr = ptr; column(col).push_back(tv); ADD_VAR_QT}
|
||||
void QPIConsole::addVariable(const QString & name, const ushort * ptr, int col, Formats format) {
|
||||
ADD_VAR_BODY tv.type = 10; tv.ptr = ptr; column(col).push_back(tv); ADD_VAR_QT}
|
||||
void QPIConsole::addVariable(const QString & name, const uchar * ptr, int col, Formats format) {
|
||||
ADD_VAR_BODY tv.type = 11; tv.ptr = ptr; column(col).push_back(tv); ADD_VAR_QT}
|
||||
void QPIConsole::addVariable(const QString & name, const llong * ptr, int col, Formats format) {
|
||||
ADD_VAR_BODY tv.type = 12; tv.ptr = ptr; column(col).push_back(tv); ADD_VAR_QT}
|
||||
void QPIConsole::addVariable(const QString & name, const ullong * ptr, int col, Formats format) {
|
||||
ADD_VAR_BODY tv.type = 13; tv.ptr = ptr; column(col).push_back(tv); ADD_VAR_QT}
|
||||
void QPIConsole::addBitVariable(const QString & name, const void * ptr, int fromBit, int bitCount, int col, Formats format) {
|
||||
tv.name = name; tv.bitFrom = fromBit; tv.bitCount = bitCount; tv.type = 14; tv.ptr = ptr; tv.format = format;
|
||||
checkColumn(col); column(col).push_back(tv); ADD_VAR_QT}
|
||||
void QPIConsole::addEmptyLine(int col, uint count) {
|
||||
tv.name = ""; tv.type = 0; tv.ptr = 0; tv.format = Normal;
|
||||
for (uint i = 0; i < count; ++i) {
|
||||
checkColumn(col);
|
||||
column(col).push_back(tv);
|
||||
QLabel * lbl = new QLabel();
|
||||
lbl->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||
column(col).variables.back().label = lbl; column(col).variables.back().widget = 0;
|
||||
lbl->setAlignment(column(col).alignment);
|
||||
applyFormat(lbl, tv.format);
|
||||
column(col).layout->addRow(lbl);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int QPIConsole::addTab(const QString & name, char bind_key) {
|
||||
QWidget * w = new QWidget();
|
||||
QVBoxLayout * lay = new QVBoxLayout();
|
||||
QHBoxLayout * clay = new QHBoxLayout();
|
||||
QLabel * lbl = new QLabel();
|
||||
lay->setContentsMargins(2, 2, 2, 2);
|
||||
clay->setContentsMargins(0, 0, 0, 0);
|
||||
lay->addLayout(clay);
|
||||
lay->addSpacerItem(new QSpacerItem(1, 1, QSizePolicy::Preferred, QSizePolicy::Expanding));
|
||||
lay->addWidget(lbl);
|
||||
w->setLayout(lay);
|
||||
QTabWidget::addTab(w, name);
|
||||
tabs.push_back(Tab(name, bind_key));
|
||||
tabs.back().layout = clay;
|
||||
tabs.back().widget = lbl;
|
||||
cur_tab = tabs.size() - 1;
|
||||
setCurrentIndex(cur_tab);
|
||||
return tabs.size();
|
||||
}
|
||||
|
||||
|
||||
void QPIConsole::checkColumn(int col) {
|
||||
while (columns().size() < col) {
|
||||
QFormLayout * lay = new QFormLayout();
|
||||
lay->setContentsMargins(2, 2, 2, 2);
|
||||
lay->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
|
||||
columns().push_back(Column(def_align));
|
||||
columns().back().layout = lay;
|
||||
tabs[cur_tab].layout->addLayout(lay);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int QPIConsole::bitsValue(const void * src, int offset, int count) const {
|
||||
int ret = 0, stbyte = offset / 8, cbit = offset - stbyte * 8;
|
||||
char cbyte = reinterpret_cast<const char * >(src)[stbyte];
|
||||
for (int i = 0; i < count; i++) {
|
||||
ret |= ((cbyte >> cbit & 1) << i);
|
||||
cbit++;
|
||||
if (cbit == 8) {
|
||||
cbit = 0;
|
||||
stbyte++;
|
||||
cbyte = reinterpret_cast<const char * >(src)[stbyte];
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
const QString & QPIConsole::toBin(const void * d, int s) {
|
||||
binstr.clear();
|
||||
uchar cc, b;
|
||||
for (int i = 0; i < s; ++i) {
|
||||
cc = ((const uchar *)d)[i];
|
||||
b = 1;
|
||||
for (int j = 0; j < 8; ++j) {
|
||||
binstr.prepend(cc & b ? "1" : "0");
|
||||
b <<= 1;
|
||||
}
|
||||
if (i < s - 1) binstr.prepend(" ");
|
||||
}
|
||||
return binstr;
|
||||
}
|
||||
|
||||
|
||||
void QPIConsole::applyFormat(QLabel * l, QPIConsole::Formats f) {
|
||||
QColor fcol = Qt::black, bcol = QColor(0xFFFFFF);
|
||||
QFont fnt = font();
|
||||
|
||||
if (f.testFlag(QPIConsole::Bold)) fnt.setBold(true);
|
||||
if (f.testFlag(QPIConsole::Italic)) fnt.setItalic(true);
|
||||
if (f.testFlag(QPIConsole::Underline)) fnt.setUnderline(true);
|
||||
|
||||
if (f.testFlag(QPIConsole::Black)) fcol = Qt::black;
|
||||
if (f.testFlag(QPIConsole::Red)) fcol = Qt::red;
|
||||
if (f.testFlag(QPIConsole::Green)) fcol = Qt::green;
|
||||
if (f.testFlag(QPIConsole::Yellow)) fcol = Qt::yellow;
|
||||
if (f.testFlag(QPIConsole::Blue)) fcol = Qt::blue;
|
||||
if (f.testFlag(QPIConsole::Magenta)) fcol = Qt::magenta;
|
||||
if (f.testFlag(QPIConsole::Cyan)) fcol = Qt::cyan;
|
||||
if (f.testFlag(QPIConsole::White)) fcol = Qt::white;
|
||||
if (f.testFlag(QPIConsole::Lighter)) fcol = fcol.lighter(150);
|
||||
if (f.testFlag(QPIConsole::Darker)) fcol = fcol.darker(150);
|
||||
|
||||
if (f.testFlag(QPIConsole::BackBlack)) bcol = Qt::black;
|
||||
if (f.testFlag(QPIConsole::BackRed)) bcol = Qt::red;
|
||||
if (f.testFlag(QPIConsole::BackGreen)) bcol = Qt::green;
|
||||
if (f.testFlag(QPIConsole::BackYellow)) bcol = Qt::yellow;
|
||||
if (f.testFlag(QPIConsole::BackBlue)) bcol = Qt::blue;
|
||||
if (f.testFlag(QPIConsole::BackMagenta)) bcol = Qt::magenta;
|
||||
if (f.testFlag(QPIConsole::BackCyan)) bcol = Qt::cyan;
|
||||
if (f.testFlag(QPIConsole::BackWhite)) bcol = Qt::white;
|
||||
if (f.testFlag(QPIConsole::BackLighter)) bcol = bcol.lighter(150);
|
||||
if (f.testFlag(QPIConsole::BackDarker)) bcol = bcol.darker(150);
|
||||
|
||||
if (f.testFlag(QPIConsole::Inverse)) {
|
||||
QColor tc = fcol;
|
||||
fcol = bcol;
|
||||
bcol = tc;
|
||||
}
|
||||
|
||||
l->setFont(fnt);
|
||||
QPalette pal = palette();
|
||||
pal.setColor(QPalette::WindowText, fcol);
|
||||
pal.setColor(QPalette::Window, bcol);
|
||||
l->setPalette(pal);
|
||||
l->setAutoFillBackground(bcol != QColor(0xFFFFFF));
|
||||
}
|
||||
|
||||
|
||||
bool QPIConsole::removeTab(uint index) {
|
||||
if (int(index) >= tabs.size()) return false;
|
||||
delete QTabWidget::widget(index);
|
||||
tabs.remove(index);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool QPIConsole::setTab(uint index) {
|
||||
if (int(index) >= tabs.size()) return false;
|
||||
setCurrentIndex(index);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool QPIConsole::renameTab(uint index, const QString & new_name) {
|
||||
if (int(index) >= tabs.size()) return false;
|
||||
if (tabs[index].name == new_name) return true;
|
||||
setTabText(index, new_name);
|
||||
tabs[index].name = new_name;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void QPIConsole::setTabEnabled(int index, bool on) {
|
||||
if (int(index) >= tabs.size()) return;
|
||||
if (isTabEnabled(index) == on) return;
|
||||
QTabWidget::setTabEnabled(index, on);
|
||||
}
|
||||
187
qad_widgets/qpiconsole.h
Normal file
@@ -0,0 +1,187 @@
|
||||
#ifndef QPICONSOLE_H
|
||||
#define QPICONSOLE_H
|
||||
|
||||
#include <QTabWidget>
|
||||
#include <QLabel>
|
||||
#include <QBoxLayout>
|
||||
#include <QFormLayout>
|
||||
#include <QSpacerItem>
|
||||
#include <QDebug>
|
||||
|
||||
typedef long long llong;
|
||||
typedef unsigned char uchar;
|
||||
typedef unsigned short int ushort;
|
||||
typedef unsigned int uint;
|
||||
typedef unsigned long ulong;
|
||||
typedef unsigned long long ullong;
|
||||
typedef long double ldouble;
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QPIConsole: public QTabWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
QPIConsole(QWidget * parent = 0);
|
||||
|
||||
enum Format {Normal = 0x01,
|
||||
Bold = 0x02,
|
||||
Italic = 0x08,
|
||||
Underline = 0x10,
|
||||
Inverse = 0x40,
|
||||
Black = 0x100,
|
||||
Red = 0x200,
|
||||
Green = 0x400,
|
||||
Yellow = 0x800,
|
||||
Blue = 0x1000,
|
||||
Magenta = 0x2000,
|
||||
Cyan = 0x4000,
|
||||
White = 0x8000,
|
||||
BackBlack = 0x10000,
|
||||
BackRed = 0x20000,
|
||||
BackGreen = 0x40000,
|
||||
BackYellow = 0x80000,
|
||||
BackBlue = 0x100000,
|
||||
BackMagenta = 0x200000,
|
||||
BackCyan = 0x400000,
|
||||
BackWhite = 0x800000,
|
||||
Dec = 0x1000000,
|
||||
Hex = 0x2000000,
|
||||
Oct = 0x4000000,
|
||||
Bin = 0x8000000,
|
||||
Scientific = 0x10000000,
|
||||
Lighter = 0x20000000,
|
||||
Darker = 0x40000000,
|
||||
BackLighter = 0x80000000,
|
||||
BackDarker = 0x100000000};
|
||||
|
||||
Q_DECLARE_FLAGS(Formats, Format)
|
||||
Q_FLAGS(Formats)
|
||||
Q_ENUMS(Format)
|
||||
|
||||
Q_PROPERTY(Qt::Alignment defaultAlignment READ defaultAlignment WRITE setDefaultAlignment)
|
||||
|
||||
void addString(const QString & name, int column = 1, Formats format = QPIConsole::Normal);
|
||||
void addVariable(const QString & name, const QString * ptr, int column = 1, Formats format = QPIConsole::Normal);
|
||||
void addVariable(const QString & name, const char * ptr, int column = 1, Formats format = QPIConsole::Normal);
|
||||
void addVariable(const QString & name, const bool * ptr, int column = 1, Formats format = QPIConsole::Normal);
|
||||
void addVariable(const QString & name, const short * ptr, int column = 1, Formats format = QPIConsole::Normal);
|
||||
void addVariable(const QString & name, const int * ptr, int column = 1, Formats format = QPIConsole::Normal);
|
||||
void addVariable(const QString & name, const long * ptr, int column = 1, Formats format = QPIConsole::Normal);
|
||||
void addVariable(const QString & name, const llong * ptr, int column = 1, Formats format = QPIConsole::Normal);
|
||||
void addVariable(const QString & name, const uchar * ptr, int column = 1, Formats format = QPIConsole::Normal);
|
||||
void addVariable(const QString & name, const ushort * ptr, int column = 1, Formats format = QPIConsole::Normal);
|
||||
void addVariable(const QString & name, const uint * ptr, int column = 1, Formats format = QPIConsole::Normal);
|
||||
void addVariable(const QString & name, const ulong * ptr, int column = 1, Formats format = QPIConsole::Normal);
|
||||
void addVariable(const QString & name, const ullong * ptr, int column = 1, Formats format = QPIConsole::Normal);
|
||||
void addVariable(const QString & name, const float * ptr, int column = 1, Formats format = QPIConsole::Normal);
|
||||
void addVariable(const QString & name, const double * ptr, int column = 1, Formats format = QPIConsole::Normal);
|
||||
void addBitVariable(const QString & name, const void * ptr, int fromBit, int bitCount, int column = 1, Formats format = QPIConsole::Normal);
|
||||
void addEmptyLine(int column = 1, uint count = 1);
|
||||
|
||||
uint tabsCount() const {return tabs.size();}
|
||||
QString currentTab() const {return tabs[cur_tab].name;}
|
||||
int addTab(const QString & name, char bind_key = 0);
|
||||
bool removeTab(uint index);
|
||||
bool removeTab(const QString & name) {return removeTab(tabIndex(name));}
|
||||
bool renameTab(uint index, const QString & new_name);
|
||||
bool renameTab(const QString & name, const QString & new_name) {return renameTab(tabIndex(name), new_name);}
|
||||
void setTabEnabled(int index, bool on);
|
||||
bool setTab(uint index);
|
||||
bool setTab(const QString & name) {return setTab(tabIndex(name));}
|
||||
//void clearTabs(bool clearScreen = true) {if (clearScreen && isRunning()) {toUpperLeft(); clearScreenLower();} tabs.clear();}
|
||||
|
||||
void addCustomStatus(const QString & str, Formats format = QPIConsole::Normal) {tabs[cur_tab].widget->setText(str); applyFormat(tabs[cur_tab].widget, format);}
|
||||
void clearCustomStatus() {tabs[cur_tab].widget->clear();}
|
||||
Qt::Alignment defaultAlignment() const {return def_align;}
|
||||
void setDefaultAlignment(Qt::Alignment align) {def_align = align;}
|
||||
void setColumnAlignment(int col, Qt::Alignment align) {if (col < 0 || col >= columns().size()) return; column(col).alignment = align;}
|
||||
void setColumnAlignmentToAll(Qt::Alignment align) {for (int i = 0; i < tabs.size(); ++i) for (int j = 0; j < tabs[i].columns.size(); ++j) tabs[i].columns[j].alignment = align;/* fillLabels();*/}
|
||||
|
||||
void clearVariables() {clearVariables(true);}
|
||||
void clearVariables(bool clearScreen) {/*if (clearScreen && isRunning()) {toUpperLeft(); clearScreenLower();}*/ columns().clear();}
|
||||
|
||||
private:
|
||||
void timerEvent(QTimerEvent * );
|
||||
QSize sizeHint() const {return QSize(100, 100);}
|
||||
|
||||
void checkColumn(int col);
|
||||
void applyFormat(QLabel * l, Formats f);
|
||||
int bitsValue(const void * src, int offset, int count) const;
|
||||
int tabIndex(const QString & n) const {for (int i = 0; i < tabs.size(); ++i) if (tabs[i].name == n) return i; return -1;}
|
||||
const QString & toBin(const void * d, int s);
|
||||
template <typename T>
|
||||
QString numIntString(T v, Formats f, int bits = 0) {
|
||||
if (f.testFlag(QPIConsole::Hex)) return "0x" + QString::number(v, 16).toUpper();
|
||||
if (f.testFlag(QPIConsole::Dec)) return QString::number(v);
|
||||
if (f.testFlag(QPIConsole::Oct)) return "0" + QString::number(v, 8);
|
||||
if (f.testFlag(QPIConsole::Bin)) return toBin(&v, bits);
|
||||
return QString::number(v);
|
||||
}
|
||||
template <typename T>
|
||||
QString numFloatString(T v, Formats f) {
|
||||
if (f.testFlag(QPIConsole::Scientific)) return QString::number(v, 'E', 5);
|
||||
return QString::number(v);
|
||||
}
|
||||
|
||||
struct Variable {
|
||||
Variable() {label = widget = 0;}
|
||||
QString name;
|
||||
Formats format;
|
||||
int type;
|
||||
int bitFrom;
|
||||
int bitCount;
|
||||
const void * ptr;
|
||||
QLabel * label;
|
||||
QLabel * widget;
|
||||
void operator =(const Variable & src) {name = src.name; format = src.format; type = src.type;
|
||||
bitFrom = src.bitFrom; bitCount = src.bitCount; ptr = src.ptr;}
|
||||
};
|
||||
|
||||
struct Column {
|
||||
Column(Qt::Alignment align = Qt::AlignRight) {variables.reserve(16); alignment = align;}
|
||||
QVector<Variable> variables;
|
||||
Qt::Alignment alignment;
|
||||
QFormLayout * layout;
|
||||
int size() const {return variables.size();}
|
||||
Variable & operator [](int index) {return variables[index];}
|
||||
const Variable & operator [](int index) const {return variables[index];}
|
||||
void push_back(const Variable & v) {variables.push_back(v);}
|
||||
void operator =(const Column & src) {variables = src.variables; alignment = src.alignment;}
|
||||
};
|
||||
|
||||
struct Tab {
|
||||
Tab(QString n = "", char k = 0) {columns.reserve(16); name = n; key = k;}
|
||||
QVector<Column> columns;
|
||||
QString name;
|
||||
char key;
|
||||
QHBoxLayout * layout;
|
||||
QLabel * widget;
|
||||
};
|
||||
|
||||
QVector<Column> & columns() {return tabs[cur_tab].columns;}
|
||||
Column & column(int index) {return tabs[cur_tab].columns[index - 1];}
|
||||
|
||||
Qt::Alignment def_align;
|
||||
QVector<Tab> tabs;
|
||||
QString binstr;
|
||||
Variable tv;
|
||||
int cur_tab, timer;
|
||||
|
||||
private slots:
|
||||
void tabChanged(int tab) {cur_tab = tab;}
|
||||
|
||||
public slots:
|
||||
void start(float freq = 40) {if (timer >= 0) killTimer(timer); timer = startTimer(freq > 0. ? 1000 / freq : 25);}
|
||||
void stop() {if (timer >= 0) killTimer(timer); timer = -1;}
|
||||
|
||||
};
|
||||
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(QPIConsole::Formats)
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // QPICONSOLE_H
|
||||
69
qad_widgets/qpiconsoleplugin.cpp
Normal file
@@ -0,0 +1,69 @@
|
||||
#include "qpiconsole.h"
|
||||
#include "qpiconsoleplugin.h"
|
||||
#include <QtCore/QtPlugin>
|
||||
|
||||
|
||||
QPIConsolePlugin::QPIConsolePlugin(QObject * parent): QObject(parent) {
|
||||
m_initialized = false;
|
||||
}
|
||||
|
||||
|
||||
void QPIConsolePlugin::initialize(QDesignerFormEditorInterface * /* core */) {
|
||||
if (m_initialized)
|
||||
return;
|
||||
|
||||
// Add extension registrations, etc. here
|
||||
|
||||
m_initialized = true;
|
||||
}
|
||||
|
||||
|
||||
bool QPIConsolePlugin::isInitialized() const {
|
||||
return m_initialized;
|
||||
}
|
||||
|
||||
|
||||
QWidget * QPIConsolePlugin::createWidget(QWidget * parent) {
|
||||
return new QPIConsole(parent);
|
||||
}
|
||||
|
||||
|
||||
QString QPIConsolePlugin::name() const {
|
||||
return QLatin1String("QPIConsole");
|
||||
}
|
||||
|
||||
|
||||
QString QPIConsolePlugin::group() const {
|
||||
return QLatin1String("Display Widgets");
|
||||
}
|
||||
|
||||
|
||||
QIcon QPIConsolePlugin::icon() const {
|
||||
return QIcon(":/icons/qpiconsole.png");
|
||||
}
|
||||
|
||||
|
||||
QString QPIConsolePlugin::toolTip() const {
|
||||
return QLatin1String("QPIConsole");
|
||||
}
|
||||
|
||||
|
||||
QString QPIConsolePlugin::whatsThis() const {
|
||||
return QLatin1String("QPIConsole");
|
||||
}
|
||||
|
||||
|
||||
bool QPIConsolePlugin::isContainer() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
QString QPIConsolePlugin::domXml() const {
|
||||
return QLatin1String("<widget class=\"QPIConsole\" name=\"piConsole\">\n</widget>\n");
|
||||
}
|
||||
|
||||
|
||||
QString QPIConsolePlugin::includeFile() const {
|
||||
return QLatin1String("qpiconsole.h");
|
||||
}
|
||||
|
||||
31
qad_widgets/qpiconsoleplugin.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef QPICONSOLEPLUGIN_H
|
||||
#define QPICONSOLEPLUGIN_H
|
||||
|
||||
#include <QDesignerCustomWidgetInterface>
|
||||
|
||||
class QPIConsolePlugin: public QObject, public QDesignerCustomWidgetInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(QDesignerCustomWidgetInterface)
|
||||
|
||||
public:
|
||||
QPIConsolePlugin(QObject * parent = 0);
|
||||
|
||||
bool isContainer() const;
|
||||
bool isInitialized() const;
|
||||
QIcon icon() const;
|
||||
QString domXml() const;
|
||||
QString group() const;
|
||||
QString includeFile() const;
|
||||
QString name() const;
|
||||
QString toolTip() const;
|
||||
QString whatsThis() const;
|
||||
QWidget * createWidget(QWidget * parent);
|
||||
void initialize(QDesignerFormEditorInterface * core);
|
||||
|
||||
private:
|
||||
bool m_initialized;
|
||||
|
||||
};
|
||||
|
||||
#endif // QPICONSOLEPLUGIN_H
|
||||
33
qad_widgets/qpointedit.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
#include "qpointedit.h"
|
||||
|
||||
|
||||
QPointEdit::QPointEdit(QWidget * parent): QWidget(parent), lay(QBoxLayout::LeftToRight, this) {
|
||||
s_x = new QDoubleSpinBox(this);
|
||||
s_y = new QDoubleSpinBox(this);
|
||||
s_x->setMinimum(-DBL_MAX);
|
||||
s_x->setMaximum(DBL_MAX);
|
||||
s_y->setMinimum(-DBL_MAX);
|
||||
s_y->setMaximum(DBL_MAX);
|
||||
s_x->setToolTip(tr("X"));
|
||||
s_y->setToolTip(tr("Y"));
|
||||
lbl = new QLabel(this);
|
||||
lbl->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
|
||||
lbl->setText("x");
|
||||
lay.setContentsMargins(0, 0, 0, 0);
|
||||
lay.setSpacing(1);
|
||||
lay.addWidget(s_x);
|
||||
lay.addWidget(lbl);
|
||||
lay.addWidget(s_y);
|
||||
connect(s_x, SIGNAL(valueChanged(double)), this, SLOT(changed()));
|
||||
connect(s_y, SIGNAL(valueChanged(double)), this, SLOT(changed()));
|
||||
}
|
||||
|
||||
|
||||
void QPointEdit::changeEvent(QEvent * e) {
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
s_x->setToolTip(tr("X"));
|
||||
s_y->setToolTip(tr("Y"));
|
||||
return;
|
||||
}
|
||||
QWidget::changeEvent(e);
|
||||
}
|
||||
43
qad_widgets/qpointedit.h
Normal file
@@ -0,0 +1,43 @@
|
||||
#ifndef QPOINTEDIT_H
|
||||
#define QPOINTEDIT_H
|
||||
|
||||
#include <QDoubleSpinBox>
|
||||
#include <QBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QEvent>
|
||||
#include "float.h"
|
||||
|
||||
|
||||
class QPointEdit: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QPointF value READ value WRITE setValue)
|
||||
Q_PROPERTY(int decimals READ decimals WRITE setDecimals)
|
||||
|
||||
public:
|
||||
explicit QPointEdit(QWidget * parent = 0);
|
||||
~QPointEdit() {delete s_x; delete s_y; delete lbl;}
|
||||
|
||||
QPointF value() const {return QPointF(s_x->value(), s_y->value());}
|
||||
int decimals() const {return s_x->decimals();}
|
||||
|
||||
public slots:
|
||||
void setValue(QPointF v) {s_x->setValue(v.x()); s_y->setValue(v.y());}
|
||||
void setDecimals(int d) {s_x->setDecimals(d); s_y->setDecimals(d);}
|
||||
|
||||
private:
|
||||
virtual void changeEvent(QEvent * e);
|
||||
|
||||
QBoxLayout lay;
|
||||
QDoubleSpinBox * s_x, * s_y;
|
||||
QLabel * lbl;
|
||||
|
||||
private slots:
|
||||
void changed() {emit valueChanged(QPointF(s_x->value(), s_y->value()));}
|
||||
|
||||
signals:
|
||||
void valueChanged(QPointF);
|
||||
|
||||
};
|
||||
|
||||
#endif // QPOINTEDIT_H
|
||||
69
qad_widgets/qpointeditplugin.cpp
Normal file
@@ -0,0 +1,69 @@
|
||||
#include "qpointedit.h"
|
||||
#include "qpointeditplugin.h"
|
||||
#include <QtCore/QtPlugin>
|
||||
|
||||
|
||||
QPointEditPlugin::QPointEditPlugin(QObject * parent): QObject(parent) {
|
||||
m_initialized = false;
|
||||
}
|
||||
|
||||
|
||||
void QPointEditPlugin::initialize(QDesignerFormEditorInterface * /* core */) {
|
||||
if (m_initialized)
|
||||
return;
|
||||
|
||||
// Add extension registrations, etc. here
|
||||
|
||||
m_initialized = true;
|
||||
}
|
||||
|
||||
|
||||
bool QPointEditPlugin::isInitialized() const {
|
||||
return m_initialized;
|
||||
}
|
||||
|
||||
|
||||
QWidget * QPointEditPlugin::createWidget(QWidget * parent) {
|
||||
return new QPointEdit(parent);
|
||||
}
|
||||
|
||||
|
||||
QString QPointEditPlugin::name() const {
|
||||
return QLatin1String("QPointEdit");
|
||||
}
|
||||
|
||||
|
||||
QString QPointEditPlugin::group() const {
|
||||
return QLatin1String("Input Widgets");
|
||||
}
|
||||
|
||||
|
||||
QIcon QPointEditPlugin::icon() const {
|
||||
return QIcon(":/icons/qpointedit.png");
|
||||
}
|
||||
|
||||
|
||||
QString QPointEditPlugin::toolTip() const {
|
||||
return QLatin1String("Point Edit");
|
||||
}
|
||||
|
||||
|
||||
QString QPointEditPlugin::whatsThis() const {
|
||||
return QLatin1String("Point Edit");
|
||||
}
|
||||
|
||||
|
||||
bool QPointEditPlugin::isContainer() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
QString QPointEditPlugin::domXml() const {
|
||||
return QLatin1String("<widget class=\"QPointEdit\" name=\"pointEdit\">\n</widget>\n");
|
||||
}
|
||||
|
||||
|
||||
QString QPointEditPlugin::includeFile() const {
|
||||
return QLatin1String("qpointedit.h");
|
||||
}
|
||||
|
||||
31
qad_widgets/qpointeditplugin.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef QPOINTEDITPLUGIN_H
|
||||
#define QPOINTEDITPLUGIN_H
|
||||
|
||||
#include <QDesignerCustomWidgetInterface>
|
||||
|
||||
class QPointEditPlugin: public QObject, public QDesignerCustomWidgetInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(QDesignerCustomWidgetInterface)
|
||||
|
||||
public:
|
||||
QPointEditPlugin(QObject * parent = 0);
|
||||
|
||||
bool isContainer() const;
|
||||
bool isInitialized() const;
|
||||
QIcon icon() const;
|
||||
QString domXml() const;
|
||||
QString group() const;
|
||||
QString includeFile() const;
|
||||
QString name() const;
|
||||
QString toolTip() const;
|
||||
QString whatsThis() const;
|
||||
QWidget * createWidget(QWidget * parent);
|
||||
void initialize(QDesignerFormEditorInterface * core);
|
||||
|
||||
private:
|
||||
bool m_initialized;
|
||||
|
||||
};
|
||||
|
||||
#endif // QPOINTEDITPLUGIN_H
|
||||
55
qad_widgets/qrectedit.cpp
Normal file
@@ -0,0 +1,55 @@
|
||||
#include "qrectedit.h"
|
||||
|
||||
|
||||
QRectEdit::QRectEdit(QWidget * parent): QWidget(parent), lay(QBoxLayout::LeftToRight, this) {
|
||||
s_x = new QDoubleSpinBox(this);
|
||||
s_y = new QDoubleSpinBox(this);
|
||||
s_w = new QDoubleSpinBox(this);
|
||||
s_h = new QDoubleSpinBox(this);
|
||||
s_x->setMinimum(-DBL_MAX);
|
||||
s_x->setMaximum(DBL_MAX);
|
||||
s_y->setMinimum(-DBL_MAX);
|
||||
s_y->setMaximum(DBL_MAX);
|
||||
s_w->setMinimum(-DBL_MAX);
|
||||
s_w->setMaximum(DBL_MAX);
|
||||
s_h->setMinimum(-DBL_MAX);
|
||||
s_h->setMaximum(DBL_MAX);
|
||||
s_x->setToolTip(tr("X"));
|
||||
s_y->setToolTip(tr("Y"));
|
||||
s_w->setToolTip(tr("Height"));
|
||||
s_h->setToolTip(tr("Width"));
|
||||
lbl_0 = new QLabel(this);
|
||||
lbl_0->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
|
||||
lbl_0->setText("x");
|
||||
lbl_1 = new QLabel(this);
|
||||
lbl_1->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
|
||||
lbl_1->setText(";");
|
||||
lbl_2 = new QLabel(this);
|
||||
lbl_2->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
|
||||
lbl_2->setText("x");
|
||||
lay.setContentsMargins(0, 0, 0, 0);
|
||||
lay.setSpacing(1);
|
||||
lay.addWidget(s_x);
|
||||
lay.addWidget(lbl_0);
|
||||
lay.addWidget(s_y);
|
||||
lay.addWidget(lbl_1);
|
||||
lay.addWidget(s_w);
|
||||
lay.addWidget(lbl_2);
|
||||
lay.addWidget(s_h);
|
||||
connect(s_x, SIGNAL(valueChanged(double)), this, SLOT(changed()));
|
||||
connect(s_y, SIGNAL(valueChanged(double)), this, SLOT(changed()));
|
||||
connect(s_w, SIGNAL(valueChanged(double)), this, SLOT(changed()));
|
||||
connect(s_h, SIGNAL(valueChanged(double)), this, SLOT(changed()));
|
||||
}
|
||||
|
||||
|
||||
void QRectEdit::changeEvent(QEvent * e) {
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
s_x->setToolTip(tr("X"));
|
||||
s_y->setToolTip(tr("Y"));
|
||||
s_w->setToolTip(tr("Height"));
|
||||
s_h->setToolTip(tr("Width"));
|
||||
return;
|
||||
}
|
||||
QWidget::changeEvent(e);
|
||||
}
|
||||
43
qad_widgets/qrectedit.h
Normal file
@@ -0,0 +1,43 @@
|
||||
#ifndef QRECTEDIT_H
|
||||
#define QRECTEDIT_H
|
||||
|
||||
#include <QDoubleSpinBox>
|
||||
#include <QBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QEvent>
|
||||
#include "float.h"
|
||||
|
||||
|
||||
class QRectEdit: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QRectF value READ value WRITE setValue)
|
||||
Q_PROPERTY(int decimals READ decimals WRITE setDecimals)
|
||||
|
||||
public:
|
||||
explicit QRectEdit(QWidget * parent = 0);
|
||||
~QRectEdit() {delete s_x; delete s_y; delete s_w; delete s_h; delete lbl_0; delete lbl_1; delete lbl_2;}
|
||||
|
||||
QRectF value() const {return QRectF(s_x->value(), s_y->value(), s_w->value(), s_h->value());}
|
||||
int decimals() const {return s_x->decimals();}
|
||||
|
||||
public slots:
|
||||
void setValue(QRectF v) {s_x->setValue(v.x()); s_y->setValue(v.y()); s_w->setValue(v.width()); s_h->setValue(v.height());}
|
||||
void setDecimals(int d) {s_x->setDecimals(d); s_y->setDecimals(d); s_w->setDecimals(d); s_h->setDecimals(d);}
|
||||
|
||||
private:
|
||||
virtual void changeEvent(QEvent * e);
|
||||
|
||||
QBoxLayout lay;
|
||||
QDoubleSpinBox * s_x, * s_y, * s_w, * s_h;
|
||||
QLabel * lbl_0, * lbl_1, * lbl_2;
|
||||
|
||||
private slots:
|
||||
void changed() {emit valueChanged(QRectF(s_x->value(), s_y->value(), s_w->value(), s_h->value()));}
|
||||
|
||||
signals:
|
||||
void valueChanged(QRectF);
|
||||
|
||||
};
|
||||
|
||||
#endif // QRECTEDIT_H
|
||||
69
qad_widgets/qrecteditplugin.cpp
Normal file
@@ -0,0 +1,69 @@
|
||||
#include "qrectedit.h"
|
||||
#include "qrecteditplugin.h"
|
||||
#include <QtCore/QtPlugin>
|
||||
|
||||
|
||||
QRectEditPlugin::QRectEditPlugin(QObject * parent): QObject(parent) {
|
||||
m_initialized = false;
|
||||
}
|
||||
|
||||
|
||||
void QRectEditPlugin::initialize(QDesignerFormEditorInterface * /* core */) {
|
||||
if (m_initialized)
|
||||
return;
|
||||
|
||||
// Add extension registrations, etc. here
|
||||
|
||||
m_initialized = true;
|
||||
}
|
||||
|
||||
|
||||
bool QRectEditPlugin::isInitialized() const {
|
||||
return m_initialized;
|
||||
}
|
||||
|
||||
|
||||
QWidget * QRectEditPlugin::createWidget(QWidget * parent) {
|
||||
return new QRectEdit(parent);
|
||||
}
|
||||
|
||||
|
||||
QString QRectEditPlugin::name() const {
|
||||
return QLatin1String("QRectEdit");
|
||||
}
|
||||
|
||||
|
||||
QString QRectEditPlugin::group() const {
|
||||
return QLatin1String("Input Widgets");
|
||||
}
|
||||
|
||||
|
||||
QIcon QRectEditPlugin::icon() const {
|
||||
return QIcon(":/icons/qrectedit.png");
|
||||
}
|
||||
|
||||
|
||||
QString QRectEditPlugin::toolTip() const {
|
||||
return QLatin1String("Rect Edit");
|
||||
}
|
||||
|
||||
|
||||
QString QRectEditPlugin::whatsThis() const {
|
||||
return QLatin1String("Rect Edit");
|
||||
}
|
||||
|
||||
|
||||
bool QRectEditPlugin::isContainer() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
QString QRectEditPlugin::domXml() const {
|
||||
return QLatin1String("<widget class=\"QRectEdit\" name=\"rectEdit\">\n</widget>\n");
|
||||
}
|
||||
|
||||
|
||||
QString QRectEditPlugin::includeFile() const {
|
||||
return QLatin1String("qrectedit.h");
|
||||
}
|
||||
|
||||
31
qad_widgets/qrecteditplugin.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef QRECTEDITPLUGIN_H
|
||||
#define QRECTEDITPLUGIN_H
|
||||
|
||||
#include <QDesignerCustomWidgetInterface>
|
||||
|
||||
class QRectEditPlugin: public QObject, public QDesignerCustomWidgetInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(QDesignerCustomWidgetInterface)
|
||||
|
||||
public:
|
||||
QRectEditPlugin(QObject * parent = 0);
|
||||
|
||||
bool isContainer() const;
|
||||
bool isInitialized() const;
|
||||
QIcon icon() const;
|
||||
QString domXml() const;
|
||||
QString group() const;
|
||||
QString includeFile() const;
|
||||
QString name() const;
|
||||
QString toolTip() const;
|
||||
QString whatsThis() const;
|
||||
QWidget * createWidget(QWidget * parent);
|
||||
void initialize(QDesignerFormEditorInterface * core);
|
||||
|
||||
private:
|
||||
bool m_initialized;
|
||||
|
||||
};
|
||||
|
||||
#endif // QRECTEDITPLUGIN_H
|
||||
399
qad_widgets/qvariantedit.cpp
Normal file
@@ -0,0 +1,399 @@
|
||||
#include "qvariantedit.h"
|
||||
#include <QDateTimeEdit>
|
||||
#include <QFileDialog>
|
||||
|
||||
|
||||
__QVariantEditRegistrator__ __registrator__;
|
||||
|
||||
|
||||
StringListEdit::StringListEdit(QWidget * parent): QWidget(parent), lay(QBoxLayout::LeftToRight, this) {
|
||||
combo = new EComboBox(this);
|
||||
combo->setEditable(true);
|
||||
combo->setLineEdit(new CLineEdit);
|
||||
combo->setInsertPolicy(QComboBox::NoInsert);
|
||||
butt_add = new QPushButton(this);
|
||||
butt_del = new QPushButton(this);
|
||||
butt_clear = new QPushButton(this);
|
||||
/*butt_add->setIconSize(QSize(16, 16));
|
||||
butt_del->setIconSize(QSize(16, 16));
|
||||
butt_clear->setIconSize(QSize(16, 16));*/
|
||||
butt_add->setMaximumWidth(combo->height());
|
||||
butt_del->setMaximumWidth(combo->height());
|
||||
butt_clear->setMaximumWidth(combo->height());
|
||||
butt_add->setIcon(QIcon(":/icons/list-add.png"));
|
||||
butt_del->setIcon(QIcon(":/icons/edit-delete.png"));
|
||||
butt_clear->setIcon(QIcon(":/icons/edit-clear.png"));
|
||||
butt_add->setToolTip(tr("Add"));
|
||||
butt_del->setToolTip(tr("Remove"));
|
||||
butt_clear->setToolTip(tr("Clear"));
|
||||
lay.setContentsMargins(0, 0, 0, 0);
|
||||
lay.setSpacing(2);
|
||||
lay.addWidget(combo);
|
||||
lay.addWidget(butt_add);
|
||||
lay.addWidget(butt_del);
|
||||
lay.addWidget(butt_clear);
|
||||
connect(combo->lineEdit(), SIGNAL(returnPressed()), this, SLOT(editItem()));
|
||||
connect(butt_add, SIGNAL(clicked(bool)), this, SLOT(addItem()));
|
||||
connect(butt_del, SIGNAL(clicked(bool)), this, SLOT(delItem()));
|
||||
connect(butt_clear, SIGNAL(clicked(bool)), this, SLOT(clear()));
|
||||
}
|
||||
|
||||
|
||||
void StringListEdit::changeEvent(QEvent * e) {
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
butt_add->setToolTip(tr("Add"));
|
||||
butt_del->setToolTip(tr("Remove"));
|
||||
butt_clear->setToolTip(tr("Clear"));
|
||||
return;
|
||||
}
|
||||
QWidget::changeEvent(e);
|
||||
}
|
||||
|
||||
|
||||
void StringListEdit::editItem() {
|
||||
int ci = combo->currentIndex();
|
||||
if (ci < 0) return;
|
||||
combo->setItemText(ci, combo->currentText());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
PathEdit::PathEdit(QWidget * parent): QWidget(parent), lay(QBoxLayout::LeftToRight, this) {
|
||||
is_dir = is_abs = false;
|
||||
filter = tr("All files(*)");
|
||||
line = new CLineEdit(this);
|
||||
butt_select = new QPushButton(this);
|
||||
//butt_select->setIconSize(QSize(16, 16));
|
||||
butt_select->setMaximumWidth(line->height());
|
||||
butt_select->setIcon(QIcon(":/icons/document-open.png"));
|
||||
butt_select->setToolTip(tr("Choose") + " ...");
|
||||
lay.setContentsMargins(0, 0, 0, 0);
|
||||
lay.setSpacing(2);
|
||||
lay.addWidget(line);
|
||||
lay.addWidget(butt_select);
|
||||
connect(line, SIGNAL(textChanged(QString)), this, SIGNAL(valueChanged()));
|
||||
connect(butt_select, SIGNAL(clicked(bool)), this, SLOT(select()));
|
||||
}
|
||||
|
||||
|
||||
void PathEdit::changeEvent(QEvent * e) {
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
butt_select->setToolTip(tr("Choose") + " ...");
|
||||
return;
|
||||
}
|
||||
QWidget::changeEvent(e);
|
||||
}
|
||||
|
||||
|
||||
void PathEdit::select() {
|
||||
QString ret;
|
||||
if (is_dir) ret = QFileDialog::getExistingDirectory(this, tr("Select directory"), value());
|
||||
else ret = QFileDialog::getOpenFileName(this, tr("Select file"), value(), filter);
|
||||
if (ret.isEmpty()) return;
|
||||
if (!is_abs)
|
||||
ret = QDir::current().relativeFilePath(ret);
|
||||
line->setText(ret);
|
||||
emit valueChanged();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
QVariantEdit::QVariantEdit(QWidget * parent): QWidget(parent) {
|
||||
_empty = 0;
|
||||
_line = 0;
|
||||
_check = 0;
|
||||
_color = 0;
|
||||
_list = 0;
|
||||
_date = 0;
|
||||
_spin = 0;
|
||||
_rect = 0;
|
||||
_point = 0;
|
||||
_path = 0;
|
||||
_enum = 0;
|
||||
_cur_edit = 0;
|
||||
_recreate(QVariant());
|
||||
}
|
||||
|
||||
|
||||
QVariantEdit::~QVariantEdit() {
|
||||
_delete();
|
||||
}
|
||||
|
||||
|
||||
void QVariantEdit::resizeEvent(QResizeEvent * e) {
|
||||
_resize();
|
||||
QWidget::resizeEvent(e);
|
||||
}
|
||||
|
||||
|
||||
void QVariantEdit::_recreate(const QVariant & new_value) {
|
||||
if (!new_value.isValid()) {
|
||||
if (_cur_edit != _empty) _delete();
|
||||
if (_empty == 0) {
|
||||
_empty = new QLabel(trUtf8("Invalid value"), this);
|
||||
_empty->setAlignment(Qt::AlignCenter);
|
||||
_cur_edit = _empty;
|
||||
_resize();
|
||||
}
|
||||
_value = new_value;
|
||||
return;
|
||||
}
|
||||
if (_value.userType() == new_value.userType()) {
|
||||
_value = new_value;
|
||||
return;
|
||||
}
|
||||
_delete();
|
||||
switch (new_value.type()) {
|
||||
case QVariant::Bool:
|
||||
_check = new QCheckBox(this);
|
||||
_cur_edit = _check;
|
||||
connect(_check, SIGNAL(toggled(bool)), this, SLOT(_changed()));
|
||||
break;
|
||||
case QVariant::Int:
|
||||
_spin = new QDoubleSpinBox(this);
|
||||
_spin->setDecimals(0);
|
||||
_spin->setRange(-0x7FFFFFFF, 0x7FFFFFFF);
|
||||
_cur_edit = _spin;
|
||||
connect(_spin, SIGNAL(valueChanged(double)), this, SLOT(_changed()));
|
||||
break;
|
||||
case QVariant::UInt:
|
||||
_spin = new QDoubleSpinBox(this);
|
||||
_spin->setDecimals(0);
|
||||
_spin->setRange(0, 0xFFFFFFFF);
|
||||
_cur_edit = _spin;
|
||||
connect(_spin, SIGNAL(valueChanged(double)), this, SLOT(_changed()));
|
||||
break;
|
||||
case QVariant::LongLong:
|
||||
_spin = new QDoubleSpinBox(this);
|
||||
_spin->setDecimals(0);
|
||||
_spin->setRange(-0x7FFFFFFFFFFFFFFFL, 0x7FFFFFFFFFFFFFFFL);
|
||||
_cur_edit = _spin;
|
||||
connect(_spin, SIGNAL(valueChanged(double)), this, SLOT(_changed()));
|
||||
break;
|
||||
case QVariant::ULongLong:
|
||||
_spin = new QDoubleSpinBox(this);
|
||||
_spin->setDecimals(0);
|
||||
_spin->setRange(0L, 0x7FFFFFFFFFFFFFFFL);
|
||||
_cur_edit = _spin;
|
||||
connect(_spin, SIGNAL(valueChanged(double)), this, SLOT(_changed()));
|
||||
break;
|
||||
case QVariant::Double:
|
||||
_spin = new QDoubleSpinBox(this);
|
||||
_spin->setDecimals(3);
|
||||
_spin->setRange(-1E+199, 1E+199);
|
||||
_cur_edit = _spin;
|
||||
connect(_spin, SIGNAL(valueChanged(double)), this, SLOT(_changed()));
|
||||
break;
|
||||
case QVariant::Color:
|
||||
_color = new ColorButton(this);
|
||||
_color->setUseAlphaChannel(true);
|
||||
_cur_edit = _color;
|
||||
connect(_color, SIGNAL(colorChanged(QColor)), this, SLOT(_changed()));
|
||||
break;
|
||||
case QVariant::String:
|
||||
_line = new CLineEdit(this);
|
||||
_cur_edit = _line;
|
||||
connect(_line, SIGNAL(textChanged(QString)), this, SLOT(_changed()));
|
||||
break;
|
||||
case QVariant::StringList:
|
||||
_list = new StringListEdit(this);
|
||||
_cur_edit = _list;
|
||||
connect(_list, SIGNAL(valueChanged()), this, SLOT(_changed()));
|
||||
break;
|
||||
case QVariant::Rect:
|
||||
_rect = new QRectEdit(this);
|
||||
_rect->setDecimals(0);
|
||||
_cur_edit = _rect;
|
||||
connect(_rect, SIGNAL(valueChanged(QRectF)), this, SLOT(_changed()));
|
||||
break;
|
||||
case QVariant::RectF:
|
||||
_rect = new QRectEdit(this);
|
||||
_rect->setDecimals(3);
|
||||
_cur_edit = _rect;
|
||||
connect(_rect, SIGNAL(valueChanged(QRectF)), this, SLOT(_changed()));
|
||||
break;
|
||||
case QVariant::Point:
|
||||
_point = new QPointEdit(this);
|
||||
_point->setDecimals(0);
|
||||
_cur_edit = _point;
|
||||
connect(_point, SIGNAL(valueChanged(QPointF)), this, SLOT(_changed()));
|
||||
break;
|
||||
case QVariant::PointF:
|
||||
_point = new QPointEdit(this);
|
||||
_point->setDecimals(3);
|
||||
_cur_edit = _point;
|
||||
connect(_point, SIGNAL(valueChanged(QPointF)), this, SLOT(_changed()));
|
||||
break;
|
||||
case QVariant::Date:
|
||||
_date = new QDateEdit(this);
|
||||
_cur_edit = _date;
|
||||
connect(_date, SIGNAL(dateTimeChanged(QDateTime)), this, SLOT(_changed()));
|
||||
break;
|
||||
case QVariant::Time:
|
||||
_date = new QTimeEdit(this);
|
||||
_cur_edit = _date;
|
||||
connect(_date, SIGNAL(dateTimeChanged(QDateTime)), this, SLOT(_changed()));
|
||||
break;
|
||||
case QVariant::DateTime:
|
||||
_date = new QDateTimeEdit(this);
|
||||
_cur_edit = _date;
|
||||
connect(_date, SIGNAL(dateTimeChanged(QDateTime)), this, SLOT(_changed()));
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
if (!_cur_edit) {
|
||||
if (new_value.canConvert<QVariantEdit::EnumType>()) {
|
||||
_enum = new QComboBox(this);
|
||||
_setEnum(new_value.value<QVariantEdit::EnumType>());
|
||||
_cur_edit = _enum;
|
||||
connect(_enum, SIGNAL(currentIndexChanged(int)), this, SLOT(_changed()));
|
||||
}
|
||||
if (new_value.canConvert<QVariantEdit::FileType>()) {
|
||||
_path = new PathEdit(this);
|
||||
_setFile(new_value.value<QVariantEdit::FileType>());
|
||||
_cur_edit = _path;
|
||||
connect(_path, SIGNAL(valueChanged()), this, SLOT(_changed()));
|
||||
}
|
||||
if (new_value.canConvert<QVariantEdit::DirType>()) {
|
||||
_path = new PathEdit(this);
|
||||
_setDir(new_value.value<QVariantEdit::DirType>());
|
||||
_cur_edit = _path;
|
||||
connect(_path, SIGNAL(valueChanged()), this, SLOT(_changed()));
|
||||
}
|
||||
}
|
||||
//qDebug() << _cur_edit;
|
||||
if (_cur_edit) {
|
||||
_resize();
|
||||
_cur_edit->show();
|
||||
}
|
||||
_value = new_value;
|
||||
}
|
||||
|
||||
|
||||
QVariant QVariantEdit::value() const {
|
||||
switch (_value.type()) {
|
||||
case QVariant::Bool: return _check->isChecked();
|
||||
case QVariant::Int: return int(_spin->value());
|
||||
case QVariant::UInt: return (unsigned int)(_spin->value());
|
||||
case QVariant::LongLong: return qlonglong(_spin->value());
|
||||
case QVariant::ULongLong: return qulonglong(_spin->value());
|
||||
case QVariant::Double: return double(_spin->value());
|
||||
case QVariant::Color: return _color->color();
|
||||
case QVariant::String: return _line->text();
|
||||
case QVariant::StringList: return _list->value();
|
||||
case QVariant::Rect: return _rect->value().toRect();
|
||||
case QVariant::RectF: return _rect->value();
|
||||
case QVariant::Point: return _point->value().toPoint();
|
||||
case QVariant::PointF: return _point->value();
|
||||
case QVariant::Date: return _date->date();
|
||||
case QVariant::Time: return _date->time();
|
||||
case QVariant::DateTime: return _date->dateTime();
|
||||
default:
|
||||
if (_value.canConvert<QVariantEdit::EnumType>() && _enum) {
|
||||
QVariantEdit::EnumType ret;
|
||||
for (int i = 0; i < _enum->count(); ++i)
|
||||
ret.enum_list << _enum->itemText(i);
|
||||
ret.value = _enum->currentText();
|
||||
return QVariant::fromValue<QVariantEdit::EnumType>(ret);
|
||||
}
|
||||
if (_value.canConvert<QVariantEdit::FileType>() && _path) {
|
||||
if (!_path->is_dir) {
|
||||
QVariantEdit::FileType ret;
|
||||
ret.file = _path->value();
|
||||
ret.filter = _path->filter;
|
||||
ret.is_abs = _path->is_abs;
|
||||
return QVariant::fromValue<QVariantEdit::FileType>(ret);
|
||||
}
|
||||
}
|
||||
if (_value.canConvert<QVariantEdit::DirType>() && _path) {
|
||||
if (_path->is_dir) {
|
||||
QVariantEdit::DirType ret;
|
||||
ret.dir = _path->value();
|
||||
ret.is_abs = _path->is_abs;
|
||||
return QVariant::fromValue<QVariantEdit::DirType>(ret);
|
||||
}
|
||||
}
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
|
||||
void QVariantEdit::setValue(const QVariant & v) {
|
||||
_recreate(v);
|
||||
if (_cur_edit) _cur_edit->blockSignals(true);
|
||||
if (_line) {_line->setText(v.toString());}
|
||||
if (_check) {_check->setChecked(v.toBool());}
|
||||
if (_color) {_color->setColor(v.value<QColor>());}
|
||||
if (_list) {_list->setValue(v.toStringList());}
|
||||
if (_date) {_date->setDateTime(v.toDateTime());}
|
||||
if (_spin) {_spin->setValue(v.toDouble());}
|
||||
if (_rect) {_rect->setValue(v.toRectF());}
|
||||
if (_point) {_point->setValue(v.toPointF());}
|
||||
if (_path) {
|
||||
if (_path->is_dir) _setDir(v.value<QVariantEdit::DirType>());
|
||||
else _setFile(v.value<QVariantEdit::FileType>());
|
||||
}
|
||||
if (_enum) {_setEnum(v.value<QVariantEdit::EnumType>());}
|
||||
if (_cur_edit) _cur_edit->blockSignals(false);
|
||||
}
|
||||
|
||||
|
||||
void QVariantEdit::_delete() {
|
||||
if (_cur_edit)
|
||||
delete _cur_edit;
|
||||
_cur_edit = 0;
|
||||
_empty = 0;
|
||||
_line = 0;
|
||||
_check = 0;
|
||||
_color = 0;
|
||||
_list = 0;
|
||||
_date = 0;
|
||||
_spin = 0;
|
||||
_rect = 0;
|
||||
_point = 0;
|
||||
_path = 0;
|
||||
_enum = 0;
|
||||
}
|
||||
|
||||
|
||||
void QVariantEdit::_newPath() {
|
||||
_delete();
|
||||
_path = new PathEdit(this);
|
||||
_cur_edit = _path;
|
||||
_value = _value.toString();
|
||||
connect(_path, SIGNAL(valueChanged()), this, SLOT(_changed()));
|
||||
_resize();
|
||||
_cur_edit->show();
|
||||
}
|
||||
|
||||
|
||||
void QVariantEdit::_setEnum(const QVariantEdit::EnumType & v) {
|
||||
_enum->clear();
|
||||
_enum->addItems(v.enum_list);
|
||||
int i(0);
|
||||
for (i = 0; i < _enum->count(); ++i)
|
||||
if (_enum->itemText(i) == v.value) {
|
||||
_enum->setCurrentIndex(i);
|
||||
break;
|
||||
}
|
||||
if (i == _enum->count())
|
||||
_enum->setCurrentIndex(-1);
|
||||
}
|
||||
|
||||
|
||||
void QVariantEdit::_setFile(const FileType & v) {
|
||||
_path->is_dir = false;
|
||||
_path->setValue(v.file);
|
||||
_path->filter = v.filter;
|
||||
_path->is_abs = v.is_abs;
|
||||
}
|
||||
|
||||
|
||||
void QVariantEdit::_setDir(const DirType & v) {
|
||||
_path->is_dir = true;
|
||||
_path->setValue(v.dir);
|
||||
_path->is_abs = v.is_abs;
|
||||
}
|
||||
|
||||
177
qad_widgets/qvariantedit.h
Normal file
@@ -0,0 +1,177 @@
|
||||
#ifndef QVARIANTEDIT_H
|
||||
#define QVARIANTEDIT_H
|
||||
|
||||
#include "clineedit.h"
|
||||
#include "ecombobox.h"
|
||||
#include "colorbutton.h"
|
||||
#include "qrectedit.h"
|
||||
#include "qpointedit.h"
|
||||
#include <QCheckBox>
|
||||
#include <QDoubleSpinBox>
|
||||
|
||||
|
||||
class StringListEdit: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
StringListEdit(QWidget * parent = 0);
|
||||
~StringListEdit() {delete combo; delete butt_add; delete butt_del; delete butt_clear;}
|
||||
|
||||
QStringList value() const {QStringList l; for (int i = 0; i < combo->count(); ++i) l << combo->itemText(i); return l;}
|
||||
|
||||
private:
|
||||
virtual void changeEvent(QEvent * e);
|
||||
|
||||
QBoxLayout lay;
|
||||
EComboBox * combo;
|
||||
QPushButton * butt_add, * butt_del, * butt_clear;
|
||||
|
||||
public slots:
|
||||
void setValue(const QStringList & v) {combo->clear(); combo->addItems(v); combo->setCurrentIndex(0);}
|
||||
|
||||
private slots:
|
||||
void editItem();
|
||||
void addItem() {combo->addItem(combo->currentText()); emit valueChanged();}
|
||||
void delItem() {if (combo->currentIndex() < 0) return; combo->removeItem(combo->currentIndex()); emit valueChanged();}
|
||||
void clear() {if (combo->count() == 0) return; combo->clear(); emit valueChanged();}
|
||||
|
||||
signals:
|
||||
void valueChanged();
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
class PathEdit: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
PathEdit(QWidget * parent = 0);
|
||||
~PathEdit() {delete line; delete butt_select;}
|
||||
|
||||
QString value() const {return line->text();}
|
||||
|
||||
bool is_dir, is_abs;
|
||||
QString filter;
|
||||
|
||||
private:
|
||||
virtual void changeEvent(QEvent * e);
|
||||
|
||||
QBoxLayout lay;
|
||||
CLineEdit * line;
|
||||
QPushButton * butt_select;
|
||||
|
||||
public slots:
|
||||
void setValue(const QString & v) {line->setText(v);}
|
||||
|
||||
private slots:
|
||||
void select();
|
||||
|
||||
signals:
|
||||
void valueChanged();
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
class QVariantEdit: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QVariant value READ value WRITE setValue)
|
||||
|
||||
public:
|
||||
explicit QVariantEdit(QWidget * parent = 0);
|
||||
~QVariantEdit();
|
||||
|
||||
QVariant value() const;
|
||||
QSize sizeHint() const {if (_cur_edit) return _cur_edit->sizeHint(); return QWidget::sizeHint();}
|
||||
|
||||
struct EnumType {
|
||||
QString toString() const {return value;}
|
||||
QString value;
|
||||
QStringList enum_list;
|
||||
};
|
||||
|
||||
struct FileType {
|
||||
FileType(const QString & p = QString(), const QString & f = QString(), bool abs = false): file(p), filter(f), is_abs(abs) {}
|
||||
QString toString() const {return file;}
|
||||
QString file;
|
||||
QString filter;
|
||||
bool is_abs;
|
||||
};
|
||||
|
||||
struct DirType {
|
||||
DirType(const QString & d = QString(), bool abs = false): dir(d), is_abs(abs) {}
|
||||
QString toString() const {return dir;}
|
||||
QString dir;
|
||||
bool is_abs;
|
||||
};
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent * );
|
||||
void _recreate(const QVariant & new_value);
|
||||
void _delete();
|
||||
void _resize() {if (_cur_edit) _cur_edit->resize(size());}
|
||||
void _newPath();
|
||||
void _setEnum(const EnumType & v);
|
||||
void _setFile(const FileType & v);
|
||||
void _setDir(const DirType & v);
|
||||
|
||||
|
||||
QLabel * _empty;
|
||||
CLineEdit * _line;
|
||||
QCheckBox * _check;
|
||||
ColorButton * _color;
|
||||
StringListEdit * _list;
|
||||
QDateTimeEdit * _date;
|
||||
QDoubleSpinBox * _spin;
|
||||
QRectEdit * _rect;
|
||||
QPointEdit * _point;
|
||||
PathEdit * _path;
|
||||
QComboBox * _enum;
|
||||
QWidget * _cur_edit;
|
||||
QVariant _value;
|
||||
|
||||
private slots:
|
||||
void _changed() {emit valueChanged(value());}
|
||||
|
||||
public slots:
|
||||
void setValue(const QVariant & v);
|
||||
|
||||
signals:
|
||||
void valueChanged(QVariant);
|
||||
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(QVariantEdit::EnumType)
|
||||
inline QDataStream & operator <<(QDataStream & s, const QVariantEdit::EnumType & v) {s << v.value << v.enum_list; return s;}
|
||||
inline QDataStream & operator >>(QDataStream & s, QVariantEdit::EnumType & v) {s >> v.value >> v.enum_list; return s;}
|
||||
inline QDebug operator <<(QDebug s, const QVariantEdit::EnumType & v) {s.nospace() << v.value; return s.space();}
|
||||
|
||||
Q_DECLARE_METATYPE(QVariantEdit::FileType)
|
||||
inline QDataStream & operator <<(QDataStream & s, const QVariantEdit::FileType & v) {s << v.file << v.filter << v.is_abs; return s;}
|
||||
inline QDataStream & operator >>(QDataStream & s, QVariantEdit::FileType & v) {s >> v.file >> v.filter >> v.is_abs; return s;}
|
||||
inline QDebug operator <<(QDebug s, const QVariantEdit::FileType & v) {s.nospace() << v.file; return s.space();}
|
||||
|
||||
Q_DECLARE_METATYPE(QVariantEdit::DirType)
|
||||
inline QDataStream & operator <<(QDataStream & s, const QVariantEdit::DirType & v) {s << v.dir << v.is_abs; return s;}
|
||||
inline QDataStream & operator >>(QDataStream & s, QVariantEdit::DirType & v) {s >> v.dir >> v.is_abs; return s;}
|
||||
inline QDebug operator <<(QDebug s, const QVariantEdit::DirType & v) {s.nospace() << v.dir; return s.space();}
|
||||
|
||||
class __QVariantEditRegistrator__ {
|
||||
public:
|
||||
__QVariantEditRegistrator__() {
|
||||
qRegisterMetaType<QVariantEdit::EnumType>("QVariantEdit::EnumType");
|
||||
qRegisterMetaTypeStreamOperators<QVariantEdit::EnumType>("QVariantEdit::EnumType");
|
||||
|
||||
qRegisterMetaType<QVariantEdit::FileType>("QVariantEdit::FileType");
|
||||
qRegisterMetaTypeStreamOperators<QVariantEdit::FileType>("QVariantEdit::FileType");
|
||||
|
||||
qRegisterMetaType<QVariantEdit::DirType>("QVariantEdit::DirType");
|
||||
qRegisterMetaTypeStreamOperators<QVariantEdit::DirType>("QVariantEdit::DirType");
|
||||
}
|
||||
};
|
||||
|
||||
#endif // QVARIANTEDIT_H
|
||||
69
qad_widgets/qvarianteditplugin.cpp
Normal file
@@ -0,0 +1,69 @@
|
||||
#include "qvariantedit.h"
|
||||
#include "qvarianteditplugin.h"
|
||||
#include <QtCore/QtPlugin>
|
||||
|
||||
|
||||
QVariantEditPlugin::QVariantEditPlugin(QObject * parent): QObject(parent) {
|
||||
m_initialized = false;
|
||||
}
|
||||
|
||||
|
||||
void QVariantEditPlugin::initialize(QDesignerFormEditorInterface * /* core */) {
|
||||
if (m_initialized)
|
||||
return;
|
||||
|
||||
// Add extension registrations, etc. here
|
||||
|
||||
m_initialized = true;
|
||||
}
|
||||
|
||||
|
||||
bool QVariantEditPlugin::isInitialized() const {
|
||||
return m_initialized;
|
||||
}
|
||||
|
||||
|
||||
QWidget * QVariantEditPlugin::createWidget(QWidget * parent) {
|
||||
return new QVariantEdit(parent);
|
||||
}
|
||||
|
||||
|
||||
QString QVariantEditPlugin::name() const {
|
||||
return QLatin1String("QVariantEdit");
|
||||
}
|
||||
|
||||
|
||||
QString QVariantEditPlugin::group() const {
|
||||
return QLatin1String("Input Widgets");
|
||||
}
|
||||
|
||||
|
||||
QIcon QVariantEditPlugin::icon() const {
|
||||
return QIcon(":/icons/qvariantedit.png");
|
||||
}
|
||||
|
||||
|
||||
QString QVariantEditPlugin::toolTip() const {
|
||||
return QLatin1String("QVariant Edit");
|
||||
}
|
||||
|
||||
|
||||
QString QVariantEditPlugin::whatsThis() const {
|
||||
return QLatin1String("QVariant Edit");
|
||||
}
|
||||
|
||||
|
||||
bool QVariantEditPlugin::isContainer() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
QString QVariantEditPlugin::domXml() const {
|
||||
return QLatin1String("<widget class=\"QVariantEdit\" name=\"variantEdit\">\n</widget>\n");
|
||||
}
|
||||
|
||||
|
||||
QString QVariantEditPlugin::includeFile() const {
|
||||
return QLatin1String("qvariantedit.h");
|
||||
}
|
||||
|
||||
31
qad_widgets/qvarianteditplugin.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef QVARIANTEDITPLUGIN_H
|
||||
#define QVARIANTEDITPLUGIN_H
|
||||
|
||||
#include <QDesignerCustomWidgetInterface>
|
||||
|
||||
class QVariantEditPlugin: public QObject, public QDesignerCustomWidgetInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(QDesignerCustomWidgetInterface)
|
||||
|
||||
public:
|
||||
QVariantEditPlugin(QObject * parent = 0);
|
||||
|
||||
bool isContainer() const;
|
||||
bool isInitialized() const;
|
||||
QIcon icon() const;
|
||||
QString domXml() const;
|
||||
QString group() const;
|
||||
QString includeFile() const;
|
||||
QString name() const;
|
||||
QString toolTip() const;
|
||||
QString whatsThis() const;
|
||||
QWidget * createWidget(QWidget * parent);
|
||||
void initialize(QDesignerFormEditorInterface * core);
|
||||
|
||||
private:
|
||||
bool m_initialized;
|
||||
|
||||
};
|
||||
|
||||
#endif // QVARIANTEDITPLUGIN_H
|
||||
233
qad_widgets/shortcuts.cpp
Normal file
@@ -0,0 +1,233 @@
|
||||
#include "shortcuts.h"
|
||||
|
||||
|
||||
void ShortcutEdit::keyPressEvent(QKeyEvent * e) {
|
||||
Qt::KeyboardModifiers km = e->modifiers();
|
||||
km &= ~Qt::KeypadModifier;
|
||||
km &= ~Qt::GroupSwitchModifier;
|
||||
if (e->key() != Qt::Key_Control && e->key() != Qt::Key_Shift &&
|
||||
e->key() != Qt::Key_Alt && e->key() != Qt::Key_Meta)
|
||||
setText(QKeySequence(km | e->key()).toString());
|
||||
}
|
||||
|
||||
|
||||
|
||||
Shortcuts::Shortcuts(QWidget * parent, bool on): QTreeWidget(parent) {
|
||||
aw = 0;
|
||||
QImage ti(QSize(16, 16), QImage::Format_ARGB32_Premultiplied);
|
||||
QPainter p(&ti);
|
||||
p.setCompositionMode(QPainter::CompositionMode_Clear);
|
||||
p.eraseRect(ti.rect());
|
||||
p.end();
|
||||
empty_icon = QPixmap::fromImage(ti);
|
||||
bfont = font();
|
||||
bfont.setWeight(QFont::Bold);
|
||||
active = on;
|
||||
setColumnCount(2);
|
||||
#if QT_VERSION < 0x050000
|
||||
header()->setResizeMode(0, QHeaderView::ResizeToContents);
|
||||
header()->setResizeMode(1, QHeaderView::ResizeToContents);
|
||||
#else
|
||||
header()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
|
||||
header()->setSectionResizeMode(1, QHeaderView::ResizeToContents);
|
||||
#endif
|
||||
header()->setStretchLastSection(true);
|
||||
setColumnWidth(1, 200);
|
||||
setSortingEnabled(true);
|
||||
QStringList l;
|
||||
l << tr("Command") << tr("Shortcut");
|
||||
setHeaderLabels(l);
|
||||
assignWindow(parent);
|
||||
}
|
||||
|
||||
|
||||
Shortcuts::~Shortcuts() {
|
||||
foreach (ShortcutEdit * i, edits)
|
||||
delete i;
|
||||
edits.clear();
|
||||
}
|
||||
|
||||
|
||||
void Shortcuts::changeEvent(QEvent * e) {
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
QStringList l;
|
||||
l << tr("Command") << tr("Shortcut");
|
||||
setHeaderLabels(l);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Shortcuts::assignWindow(QWidget * w) {
|
||||
if (w == 0) return;
|
||||
while ((qobject_cast<QMainWindow * >(w) == 0) && (w->parentWidget() != 0))
|
||||
w = w->parentWidget();
|
||||
aw = qobject_cast<QMainWindow * >(w);
|
||||
updateShortcuts();
|
||||
}
|
||||
|
||||
|
||||
QStringList Shortcuts::actionTree(QAction * a) {
|
||||
QStringList tree;
|
||||
QList<QWidget * > aw = a->associatedWidgets();
|
||||
if (aw.size() == 0) return tree;
|
||||
QWidget * cw = 0;
|
||||
QMenu * tm;
|
||||
QToolBar * tt;
|
||||
foreach (QWidget * i, aw) {
|
||||
tm = qobject_cast<QMenu * >(i);
|
||||
if (tm == 0) continue;
|
||||
cw = i;
|
||||
while (cw != 0) {
|
||||
tm = qobject_cast<QMenu * >(cw);
|
||||
if (tm != 0) {
|
||||
if (!tm->title().isEmpty())
|
||||
tree.push_front(tm->title());
|
||||
cw = cw->parentWidget();
|
||||
} else break;
|
||||
}
|
||||
if (!tree.isEmpty()) return tree;
|
||||
}
|
||||
foreach (QWidget * i, aw) {
|
||||
tt = qobject_cast<QToolBar * >(i);
|
||||
if (tt == 0) continue;
|
||||
cw = i;
|
||||
if (!tt->windowTitle().isEmpty())
|
||||
tree.push_front(tt->windowTitle());
|
||||
break;
|
||||
}
|
||||
return tree;
|
||||
}
|
||||
|
||||
|
||||
QList<QPair<QString, QKeySequence> > Shortcuts::shortcuts() {
|
||||
QList<QPair<QString, QKeySequence> > l;
|
||||
foreach (ShortcutEdit * i, edits) {
|
||||
if (i->action()->objectName().isEmpty()) continue;
|
||||
l << QPair<QString, QKeySequence>(i->action()->objectName(), i->text());
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
|
||||
void Shortcuts::clear() {
|
||||
foreach (ShortcutEdit * i, edits)
|
||||
delete i;
|
||||
edits.clear();
|
||||
hide();
|
||||
QList<QTreeWidgetItem * > tl = findItems("", Qt::MatchContains);
|
||||
foreach (QTreeWidgetItem * i, tl)
|
||||
delete i;
|
||||
show();
|
||||
}
|
||||
|
||||
|
||||
bool Shortcuts::checkAction(QAction * a) {
|
||||
if (a->menu() != 0) return false;
|
||||
if (a->isSeparator()) return false;
|
||||
if (a->text().isEmpty()) return false;
|
||||
if (a->associatedWidgets().isEmpty()) return false;
|
||||
if (QString(a->metaObject()->className()) != "QAction") return false;
|
||||
if (qobject_cast<QWidgetAction * >(a) != 0) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Shortcuts::updateShortcuts() {
|
||||
//return;
|
||||
if (aw == 0 || !active) return;
|
||||
hide();
|
||||
int cpos = verticalScrollBar()->value();
|
||||
clear();
|
||||
#if QT_VERSION < 0x050000
|
||||
header()->setResizeMode(0, QHeaderView::Fixed);
|
||||
#else
|
||||
header()->setSectionResizeMode(0, QHeaderView::Fixed);
|
||||
#endif
|
||||
QList<QAction * > al = aw->findChildren<QAction * >();
|
||||
QTreeWidgetItem * pi, * ci;
|
||||
QStringList tree;
|
||||
bool s = isSortingEnabled(), isFound;
|
||||
setSortingEnabled(false);
|
||||
foreach (QAction * i, al) {
|
||||
if (!checkAction(i)) continue;
|
||||
edits.push_back(new ShortcutEdit());
|
||||
tree = actionTree(i);
|
||||
pi = invisibleRootItem();
|
||||
foreach (QString t, tree) {
|
||||
isFound = false;
|
||||
for (int j = 0; j < pi->childCount(); ++j) {
|
||||
if (pi->child(j)->text(0) == t) {
|
||||
pi = pi->child(j);
|
||||
isFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (isFound) continue;
|
||||
ci = new QTreeWidgetItem(pi);
|
||||
ci->setText(0, t);
|
||||
ci->setToolTip(0, t);
|
||||
ci->setFont(0, bfont);
|
||||
pi->addChild(ci);
|
||||
pi = ci;
|
||||
}
|
||||
ci = new QTreeWidgetItem(pi);
|
||||
ci->setText(0, i->text());
|
||||
ci->setToolTip(0, i->text());
|
||||
if (i->icon().isNull())
|
||||
ci->setIcon(0, empty_icon);
|
||||
else
|
||||
ci->setIcon(0, i->icon());
|
||||
edits.back()->ti = ci;
|
||||
edits.back()->assignAction(i);
|
||||
pi->addChild(ci);
|
||||
//qDebug() << "set widget" << edits.back();
|
||||
setItemWidget(ci, 1, edits.back());
|
||||
}
|
||||
setSortingEnabled(s);
|
||||
#if QT_VERSION < 0x050000
|
||||
header()->setResizeMode(0, QHeaderView::ResizeToContents);
|
||||
#else
|
||||
header()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
|
||||
#endif
|
||||
expandAll();
|
||||
verticalScrollBar()->setValue(cpos);
|
||||
show();
|
||||
}
|
||||
|
||||
|
||||
void Shortcuts::commit() {
|
||||
foreach (ShortcutEdit * i, edits)
|
||||
i->commit();
|
||||
}
|
||||
|
||||
|
||||
void Shortcuts::reset() {
|
||||
foreach (ShortcutEdit * i, edits)
|
||||
i->reset();
|
||||
updateShortcuts();
|
||||
}
|
||||
|
||||
|
||||
void Shortcuts::filter(const QString & what) {
|
||||
hide();
|
||||
for (int i = 0; i < topLevelItemCount(); ++i)
|
||||
filterTree(topLevelItem(i), what);
|
||||
show();
|
||||
}
|
||||
|
||||
|
||||
bool Shortcuts::filterTree(QTreeWidgetItem * ti, QString f) {
|
||||
if (f.isEmpty()) {
|
||||
for (int i = 0; i < ti->childCount(); ++i)
|
||||
filterTree(ti->child(i), f);
|
||||
ti->setHidden(false);
|
||||
return true;
|
||||
}
|
||||
bool isFound = false;
|
||||
for (int i = 0; i < ti->childCount(); ++i)
|
||||
if (filterTree(ti->child(i), f)) isFound = true;
|
||||
if (ti->text(0).indexOf(f, 0, Qt::CaseInsensitive) >= 0 ||
|
||||
ti->text(1).indexOf(f, 0, Qt::CaseInsensitive) >= 0) isFound = true;
|
||||
ti->setHidden(!isFound);
|
||||
return isFound;
|
||||
}
|
||||
90
qad_widgets/shortcuts.h
Normal file
@@ -0,0 +1,90 @@
|
||||
#ifndef SHORTCUTS_H
|
||||
#define SHORTCUTS_H
|
||||
|
||||
#include <QTreeWidget>
|
||||
#include <QMainWindow>
|
||||
#include <QShortcut>
|
||||
#include <QHeaderView>
|
||||
#include <QAction>
|
||||
#include <QLineEdit>
|
||||
#include <QDebug>
|
||||
#include <QKeyEvent>
|
||||
#include <QMenu>
|
||||
#include <QToolBar>
|
||||
#include <QScrollBar>
|
||||
#include <QWidgetAction>
|
||||
#include "clineedit.h"
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class ShortcutEdit: public CLineEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
friend class Shortcuts;
|
||||
public:
|
||||
explicit ShortcutEdit(QWidget * parent = 0): CLineEdit(parent) {ti = 0; connect(this, SIGNAL(textChanged(QString)), this, SLOT(textChanged_(QString)));}
|
||||
|
||||
void assignAction(QAction * a) {clear(); ca = a; reset();}
|
||||
QAction * action() const {return ca;}
|
||||
bool isEmpty() const {return text().isEmpty();}
|
||||
void commit() {if (ca == 0) return; ca->setShortcut(QKeySequence(text()));}
|
||||
void reset() {if (ca == 0) return; setText(ca->shortcut().toString());}
|
||||
|
||||
private slots:
|
||||
void textChanged_(QString t) {if (ti != 0) ti->setText(1, t);}
|
||||
|
||||
private:
|
||||
void keyPressEvent(QKeyEvent * e);
|
||||
|
||||
QAction * ca;
|
||||
QTreeWidgetItem * ti;
|
||||
|
||||
};
|
||||
|
||||
|
||||
class Shortcuts: public QTreeWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Shortcuts(QWidget * parent = 0, bool on = true);
|
||||
~Shortcuts();
|
||||
|
||||
void assignWindow(QWidget * w);
|
||||
void setActive(bool on) {active = on;}
|
||||
QList<QPair<QString, QKeySequence> > shortcuts();
|
||||
QStringList actionTree(QAction * a);
|
||||
static bool checkAction(QAction * a);
|
||||
|
||||
public slots:
|
||||
void clear();
|
||||
void updateShortcuts();
|
||||
void commit();
|
||||
void reset();
|
||||
void filter(const QString & what);
|
||||
|
||||
private:
|
||||
virtual void updateEditorGeometries() {foreach (ShortcutEdit * i, edits) i->setGeometry(visualRect(indexFromItem(i->ti, 1)));}
|
||||
virtual void changeEvent(QEvent * );
|
||||
bool filterTree(QTreeWidgetItem * ti, QString f);
|
||||
|
||||
QMainWindow * aw;
|
||||
QVector<ShortcutEdit * > edits;
|
||||
QIcon empty_icon;
|
||||
QFont bfont;
|
||||
bool active;
|
||||
|
||||
private slots:
|
||||
|
||||
signals:
|
||||
void shortcutChanged(QAction * , QShortcut & );
|
||||
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // SPINSLIDER_H
|
||||
69
qad_widgets/shortcutsplugin.cpp
Normal file
@@ -0,0 +1,69 @@
|
||||
#include "shortcuts.h"
|
||||
#include "shortcutsplugin.h"
|
||||
#include <QtCore/QtPlugin>
|
||||
|
||||
|
||||
ShortcutsPlugin::ShortcutsPlugin(QObject * parent): QObject(parent) {
|
||||
m_initialized = false;
|
||||
}
|
||||
|
||||
|
||||
void ShortcutsPlugin::initialize(QDesignerFormEditorInterface * /* core */) {
|
||||
if (m_initialized)
|
||||
return;
|
||||
|
||||
// Add extension registrations, etc. here
|
||||
|
||||
m_initialized = true;
|
||||
}
|
||||
|
||||
|
||||
bool ShortcutsPlugin::isInitialized() const {
|
||||
return m_initialized;
|
||||
}
|
||||
|
||||
|
||||
QWidget * ShortcutsPlugin::createWidget(QWidget * parent) {
|
||||
return new Shortcuts(parent, false);
|
||||
}
|
||||
|
||||
|
||||
QString ShortcutsPlugin::name() const {
|
||||
return QLatin1String("Shortcuts");
|
||||
}
|
||||
|
||||
|
||||
QString ShortcutsPlugin::group() const {
|
||||
return QLatin1String("Input Widgets");
|
||||
}
|
||||
|
||||
|
||||
QIcon ShortcutsPlugin::icon() const {
|
||||
return QIcon();
|
||||
}
|
||||
|
||||
|
||||
QString ShortcutsPlugin::toolTip() const {
|
||||
return QLatin1String("Shortcuts Edit");
|
||||
}
|
||||
|
||||
|
||||
QString ShortcutsPlugin::whatsThis() const {
|
||||
return QLatin1String("Shortcuts Edit");
|
||||
}
|
||||
|
||||
|
||||
bool ShortcutsPlugin::isContainer() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
QString ShortcutsPlugin::domXml() const {
|
||||
return QLatin1String("<widget class=\"Shortcuts\" name=\"shortcuts\">\n</widget>\n");
|
||||
}
|
||||
|
||||
|
||||
QString ShortcutsPlugin::includeFile() const {
|
||||
return QLatin1String("shortcuts.h");
|
||||
}
|
||||
|
||||