git-svn-id: svn://db.shs.com.ru/libs@338 a8b55f48-bf90-11e4-a774-851b48703e85

This commit is contained in:
2017-12-01 19:21:55 +00:00
parent 5319da69aa
commit 6c9971d795
16 changed files with 141 additions and 70 deletions

View File

@@ -1,25 +1,26 @@
<RCC>
<qresource prefix="/">
<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/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.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/sql_table.png</file>
</qresource>
<qresource prefix="/">
<file>../icons/edit-table-insert-row-below.png</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/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.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/sql_table.png</file>
</qresource>
</RCC>

View File

@@ -5,6 +5,7 @@
#include <QFileInfo>
#include <QItemDelegate>
#include <QApplication>
#include "qad_types.h"
QString SQLTableWidget::_dir;
@@ -335,12 +336,15 @@ SQLTableWidget::SQLTableWidget(QWidget * parent): QWidget(parent), filters_group
connection_name = QSqlDatabase::defaultConnection;
filters_active = first_update = true;
table_opened = read_only = false;
ui->labelNew->setFixedSize(preferredIconSize(1.2));
ui->labelFilter->setFixedSize(preferredIconSize(1.2));
ui->view->installEventFilter(this);
ui->view->viewport()->installEventFilter(this);
ui->view->horizontalHeader()->setSortIndicator(0, Qt::AscendingOrder);
ui->view->horizontalHeader()->viewport()->installEventFilter(this);
ui->view->setItemDelegate(new SQLItemDelegate(column_props, column_indexes, read_only, connection_name));
ui->view->horizontalHeader()->setItemDelegate(new QItemDelegate());
ui->view->verticalHeader()->setDefaultSectionSize(fontHeight() * 1.5);
//qDebug() << view->horizontalHeader()->itemDelegate();
//qDebug() << fontMetrics().elidedText(, Qt::ElideNone, 30, Qt::TextWordWrap);
setTableVisible(false);
@@ -526,8 +530,8 @@ bool SQLTableWidget::checkTable() {
q.value(5).toString().toLower().indexOf("auto_increment") >= 0,
q.value(3).toString().toLower().indexOf("pri") >= 0);
}*/
ui->labelNew->setFixedWidth(qMax<int>(ui->view->verticalHeader()->sizeHint().width() + 2, 16));
ui->labelFilter->setFixedWidth(qMax<int>(ui->view->verticalHeader()->sizeHint().width() + 2, 16));
//ui->labelNew->setFixedWidth(qMax<int>(ui->view->verticalHeader()->sizeHint().width() + 2, 16));
//ui->labelFilter->setFixedWidth(qMax<int>(ui->view->verticalHeader()->sizeHint().width() + 2, 16));
ui->scrollAreaNew->setFixedHeight(QLineEdit().sizeHint().height() + 2);
ui->scrollAreaFilter->setFixedHeight(QLineEdit().sizeHint().height() + 2);
qDeleteAll(column_news);
@@ -626,8 +630,8 @@ void SQLTableWidget::updateTable(bool save_selection) {
ui->view->horizontalHeader()->resizeSection(i, 100);
first_update = false;
}
ui->labelNew->setFixedWidth(qMax<int>(ui->view->verticalHeader()->sizeHint().width() + 2, 16));
ui->labelFilter->setFixedWidth(qMax<int>(ui->view->verticalHeader()->sizeHint().width() + 2, 16));
//ui->labelNew->setFixedWidth(qMax<int>(ui->view->verticalHeader()->sizeHint().width() + 2, 16));
//ui->labelFilter->setFixedWidth(qMax<int>(ui->view->verticalHeader()->sizeHint().width() + 2, 16));
ui->layoutNew->invalidate();
if (save_selection) {
QItemSelectionModel * sm = ui->view->selectionModel();

View File

@@ -7,21 +7,42 @@
<x>0</x>
<y>0</y>
<width>445</width>
<height>422</height>
<height>570</height>
</rect>
</property>
<property name="windowTitle">
<string>SQLTableWidget</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="pageEmpty">
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
@@ -38,7 +59,16 @@
</widget>
<widget class="QWidget" name="pageTable">
<layout class="QGridLayout" name="gridLayout">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
@@ -50,7 +80,16 @@
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
@@ -62,7 +101,10 @@
</size>
</property>
<property name="pixmap">
<pixmap>:/icons/edit-table-insert-row-below.png</pixmap>
<pixmap resource="qad_sql_table.qrc">:/icons/edit-table-insert-row-below.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
@@ -94,15 +136,24 @@
<rect>
<x>0</x>
<y>0</y>
<width>401</width>
<height>87</height>
<width>352</width>
<height>154</height>
</rect>
</property>
<layout class="QHBoxLayout" name="layoutNew">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
@@ -131,15 +182,9 @@
<string>Add record</string>
</property>
<property name="icon">
<iconset>
<iconset resource="qad_sql_table.qrc">
<normaloff>:/icons/list-add.png</normaloff>:/icons/list-add.png</iconset>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
</widget>
</item>
<item row="1" column="0">
@@ -148,7 +193,16 @@
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
@@ -160,7 +214,10 @@
</size>
</property>
<property name="pixmap">
<pixmap>:/icons/edit-find.png</pixmap>
<pixmap resource="qad_sql_table.qrc">:/icons/edit-find.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
@@ -192,15 +249,24 @@
<rect>
<x>0</x>
<y>0</y>
<width>401</width>
<height>87</height>
<width>154</width>
<height>256</height>
</rect>
</property>
<layout class="QHBoxLayout" name="layoutFilter">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
@@ -229,15 +295,9 @@
<string>Configure filters</string>
</property>
<property name="icon">
<iconset>
<iconset resource="qad_sql_table.qrc">
<normaloff>:/icons/configure.png</normaloff>:/icons/configure.png</iconset>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="popupMode">
<enum>QToolButton::InstantPopup</enum>
</property>
@@ -263,9 +323,6 @@
<attribute name="verticalHeaderVisible">
<bool>true</bool>
</attribute>
<attribute name="verticalHeaderDefaultSectionSize">
<number>24</number>
</attribute>
</widget>
</item>
</layout>
@@ -275,7 +332,7 @@
</layout>
<action name="actionFiltersClear">
<property name="icon">
<iconset>
<iconset resource="qad_sql_table.qrc">
<normaloff>:/icons/edit-clear.png</normaloff>:/icons/edit-clear.png</iconset>
</property>
<property name="text">
@@ -305,6 +362,8 @@
</property>
</action>
</widget>
<resources/>
<resources>
<include location="qad_sql_table.qrc"/>
</resources>
<connections/>
</ui>