git-svn-id: svn://db.shs.com.ru/libs@331 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -12,6 +12,7 @@ if(POLICY CMP0020)
|
|||||||
cmake_policy(SET CMP0020 OLD)
|
cmake_policy(SET CMP0020 OLD)
|
||||||
endif()
|
endif()
|
||||||
project(libs)
|
project(libs)
|
||||||
|
include(SDKMacros.cmake)
|
||||||
set(LIBPROJECT 1)
|
set(LIBPROJECT 1)
|
||||||
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/pip/")
|
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/pip/")
|
||||||
if(MINGW)
|
if(MINGW)
|
||||||
|
|||||||
@@ -2,9 +2,7 @@ project(qad)
|
|||||||
cmake_minimum_required(VERSION 2.6)
|
cmake_minimum_required(VERSION 2.6)
|
||||||
#cmake_policy(SET CMP0017 OLD)
|
#cmake_policy(SET CMP0017 OLD)
|
||||||
#find_package(Qt4 REQUIRED)
|
#find_package(Qt4 REQUIRED)
|
||||||
if (LIBPROJECT)
|
if (NOT LIBPROJECT)
|
||||||
include(../SDKMacros.cmake)
|
|
||||||
else()
|
|
||||||
option(LIB "System install" 1)
|
option(LIB "System install" 1)
|
||||||
option(DEBUG "Build with -g3" 0)
|
option(DEBUG "Build with -g3" 0)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -Wall")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -Wall")
|
||||||
|
|||||||
@@ -1,24 +1,32 @@
|
|||||||
#include "clineedit.h"
|
#include "clineedit.h"
|
||||||
|
#include "qad_types.h"
|
||||||
|
|
||||||
|
|
||||||
CLineEdit::CLineEdit(QWidget * parent): QLineEdit(parent) {
|
CLineEdit::CLineEdit(QWidget * parent): QLineEdit(parent) {
|
||||||
cw = new QWidget(this);
|
cw = new QWidget(this);
|
||||||
cw->setStyleSheet("background-image: url(:/icons/edit-clear-locationbar-rtl.png);");
|
clear_im.load(":/icons/edit-clear-locationbar-rtl.png");
|
||||||
cw->setCursor(Qt::ArrowCursor);
|
cw->setCursor(Qt::ArrowCursor);
|
||||||
cw->setToolTip(tr("Clear"));
|
cw->setToolTip(tr("Clear"));
|
||||||
cw->hide();
|
cw->hide();
|
||||||
cw->installEventFilter(this);
|
cw->installEventFilter(this);
|
||||||
|
connect(this, SIGNAL(textChanged(QString)), this, SLOT(textChanged_(QString)));
|
||||||
|
int is = fontHeight();
|
||||||
int m0, m1, m2, m3;
|
int m0, m1, m2, m3;
|
||||||
getTextMargins(&m0, &m1, &m2, &m3);
|
getTextMargins(&m0, &m1, &m2, &m3);
|
||||||
setTextMargins(m0, m1, m2 + 21, m3);
|
setTextMargins(m0, m1, m2 + (is * 1.2), m3);
|
||||||
connect(this, SIGNAL(textChanged(QString)), this, SLOT(textChanged_(QString)));
|
|
||||||
//connect(cw, SIGNAL(mouseReleaseEvent(QMouseEvent * )), this, SLOT(clearMouseRelease(QMouseEvent * )));
|
//connect(cw, SIGNAL(mouseReleaseEvent(QMouseEvent * )), this, SLOT(clearMouseRelease(QMouseEvent * )));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool CLineEdit::eventFilter(QObject * o, QEvent * e) {
|
bool CLineEdit::eventFilter(QObject * o, QEvent * e) {
|
||||||
if (e->type() == QEvent::MouseButtonRelease) {
|
switch (e->type()) {
|
||||||
|
case QEvent::MouseButtonRelease:
|
||||||
clearMouseRelease((QMouseEvent * )e);
|
clearMouseRelease((QMouseEvent * )e);
|
||||||
|
break;
|
||||||
|
case QEvent::Paint:
|
||||||
|
cwPaintEvent();
|
||||||
|
break;
|
||||||
|
default : break;
|
||||||
}
|
}
|
||||||
return QLineEdit::eventFilter(o, e);
|
return QLineEdit::eventFilter(o, e);
|
||||||
}
|
}
|
||||||
@@ -26,7 +34,8 @@ bool CLineEdit::eventFilter(QObject * o, QEvent * e) {
|
|||||||
|
|
||||||
void CLineEdit::resizeEvent(QResizeEvent * e) {
|
void CLineEdit::resizeEvent(QResizeEvent * e) {
|
||||||
QLineEdit::resizeEvent(e);
|
QLineEdit::resizeEvent(e);
|
||||||
cw->setGeometry(width() - 21, (height() - 17) / 2, 16, 16);
|
int is = fontHeight(), tm = (height() - is) / 2;
|
||||||
|
cw->setGeometry(width() - is - tm, tm, is, is);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -39,6 +48,13 @@ void CLineEdit::changeEvent(QEvent * e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CLineEdit::cwPaintEvent() {
|
||||||
|
QPainter p(cw);
|
||||||
|
p.setRenderHint(QPainter::SmoothPixmapTransform);
|
||||||
|
p.drawImage(cw->rect(), clear_im);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void CLineEdit::setDefaultText(const QString & t, bool set_text) {
|
void CLineEdit::setDefaultText(const QString & t, bool set_text) {
|
||||||
dt = t;
|
dt = t;
|
||||||
if (set_text) {
|
if (set_text) {
|
||||||
|
|||||||
@@ -21,11 +21,13 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
QWidget * cw;
|
QWidget * cw;
|
||||||
QString dt;
|
QString dt;
|
||||||
|
QImage clear_im;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool eventFilter(QObject * o, QEvent * e);
|
bool eventFilter(QObject * o, QEvent * e);
|
||||||
void resizeEvent(QResizeEvent * );
|
void resizeEvent(QResizeEvent * );
|
||||||
void changeEvent(QEvent * e);
|
void changeEvent(QEvent * e);
|
||||||
|
void cwPaintEvent();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void clearMouseRelease(QMouseEvent * e) {if (cw->rect().contains(e->pos())) clearClick();}
|
void clearMouseRelease(QMouseEvent * e) {if (cw->rect().contains(e->pos())) clearClick();}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ qt_add_library(${PROJECT_NAME} SHARED out_CPP)
|
|||||||
qt_target_link_libraries(${PROJECT_NAME} pip qad_utils qad_widgets cd_utils piqt)
|
qt_target_link_libraries(${PROJECT_NAME} pip qad_utils qad_widgets cd_utils piqt)
|
||||||
message(STATUS "Building ${PROJECT_NAME}")
|
message(STATUS "Building ${PROJECT_NAME}")
|
||||||
if(LIBPROJECT)
|
if(LIBPROJECT)
|
||||||
sdk_install("" "${PROJECT_NAME}" "${out_HDR}" "${out_QM}")
|
#sdk_install("" "${PROJECT_NAME}" "${out_HDR}" "${out_QM}")
|
||||||
else()
|
else()
|
||||||
if(LIB)
|
if(LIB)
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
|
|||||||
Reference in New Issue
Block a user