Add (basic) QHeaderView; Support wrappers on plain Qt widgets
This commit is contained in:
parent
11c33771c2
commit
053fc9dc65
@ -95,6 +95,7 @@ add_library(${CORE_WIDGETS_ADDON} SHARED
|
||||
"${PROJECT_SOURCE_DIR}/src/cpp/lib/QtWidgets/QFrame/qframe_wrap.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/cpp/lib/QtWidgets/QGraphicsBlurEffect/qgraphicsblureffect_wrap.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/cpp/lib/QtWidgets/QGraphicsDropShadowEffect/qgraphicsdropshadoweffect_wrap.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/cpp/lib/QtWidgets/QHeaderView/qheaderview_wrap.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/cpp/lib/QtWidgets/QListView/qlistview_wrap.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/cpp/lib/QtWidgets/QListWidget/qlistwidget_wrap.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/cpp/lib/QtWidgets/QListWidgetItem/qlistwidgetitem_wrap.cpp"
|
||||
@ -208,6 +209,7 @@ add_library(${CORE_WIDGETS_ADDON} SHARED
|
||||
"${PROJECT_SOURCE_DIR}/src/cpp/include/nodegui/QtWidgets/QTextEdit/ntextedit.hpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/cpp/include/nodegui/QtWidgets/QSvgWidget/nsvgwidget.hpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/cpp/include/nodegui/QtWidgets/QDesktopWidget/nqdesktopwidget.hpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/cpp/include/nodegui/QtWidgets/QHeaderView/nheaderview.hpp"
|
||||
)
|
||||
|
||||
AddCommonConfig(${CORE_WIDGETS_ADDON})
|
||||
|
||||
@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include <QHeaderView>
|
||||
|
||||
#include "Extras/Utils/nutils.h"
|
||||
#include "QtWidgets/QAbstractItemView/qabstractitemview_macro.h"
|
||||
#include "core/NodeWidget/nodewidget.h"
|
||||
|
||||
class DLL_EXPORT NHeaderView : public QHeaderView, public NodeWidget {
|
||||
Q_OBJECT
|
||||
NODEWIDGET_IMPLEMENTATIONS(QHeaderView)
|
||||
public:
|
||||
using QHeaderView::QHeaderView;
|
||||
|
||||
void connectSignalsToEventEmitter() { QABSTRACTITEMVIEW_SIGNALS }
|
||||
};
|
||||
@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
#include <napi.h>
|
||||
|
||||
#include <QPointer>
|
||||
|
||||
#include "Extras/Utils/nutils.h"
|
||||
#include "QtWidgets/QAbstractItemView/qabstractitemview_macro.h"
|
||||
#include "QtWidgets/QHeaderView/nheaderview.hpp"
|
||||
|
||||
class DLL_EXPORT QHeaderViewWrap : public Napi::ObjectWrap<QHeaderViewWrap> {
|
||||
QABSTRACTITEMVIEW_WRAPPED_METHODS_DECLARATION
|
||||
private:
|
||||
QPointer<QHeaderView> instance;
|
||||
bool disableDeletion;
|
||||
|
||||
public:
|
||||
static Napi::Object init(Napi::Env env, Napi::Object exports);
|
||||
QHeaderViewWrap(const Napi::CallbackInfo& info);
|
||||
~QHeaderViewWrap();
|
||||
QHeaderView* getInternalInstance();
|
||||
// class constructor
|
||||
static Napi::FunctionReference constructor;
|
||||
// wrapped methods
|
||||
};
|
||||
@ -3,6 +3,7 @@
|
||||
#include <QTableView>
|
||||
|
||||
#include "QtWidgets/QAbstractItemView/qabstractitemview_macro.h"
|
||||
#include "QtWidgets/QHeaderView/qheaderview_wrap.h"
|
||||
|
||||
/*
|
||||
|
||||
@ -203,48 +204,66 @@
|
||||
Qt::SortOrder order = static_cast<Qt::SortOrder>(orderInt); \
|
||||
this->instance->sortByColumn(column, order); \
|
||||
return env.Null(); \
|
||||
} \
|
||||
Napi::Value horizontalHeader(const Napi::CallbackInfo& info) { \
|
||||
Napi::Env env = info.Env(); \
|
||||
Napi::HandleScope scope(env); \
|
||||
auto header = this->instance->horizontalHeader(); \
|
||||
auto instance = QHeaderViewWrap::constructor.New( \
|
||||
{Napi::External<QHeaderView>::New(env, header)}); \
|
||||
return instance; \
|
||||
} \
|
||||
Napi::Value verticalHeader(const Napi::CallbackInfo& info) { \
|
||||
Napi::Env env = info.Env(); \
|
||||
Napi::HandleScope scope(env); \
|
||||
auto header = this->instance->verticalHeader(); \
|
||||
auto instance = QHeaderViewWrap::constructor.New( \
|
||||
{Napi::External<QHeaderView>::New(env, header)}); \
|
||||
return instance; \
|
||||
}
|
||||
|
||||
#endif // QTABLEVIEW_WRAPPED_METHODS_DECLARATION
|
||||
|
||||
#ifndef QTABLEVIEW_WRAPPED_METHODS_EXPORT_DEFINE
|
||||
#define QTABLEVIEW_WRAPPED_METHODS_EXPORT_DEFINE(WidgetWrapName) \
|
||||
\
|
||||
QABSTRACTITEMVIEW_WRAPPED_METHODS_EXPORT_DEFINE(WidgetWrapName) \
|
||||
\
|
||||
InstanceMethod("clearSpans", &WidgetWrapName::clearSpans), \
|
||||
InstanceMethod("columnAt", &WidgetWrapName::columnAt), \
|
||||
InstanceMethod("columnSpan", &WidgetWrapName::columnSpan), \
|
||||
InstanceMethod("columnViewportPosition", \
|
||||
&WidgetWrapName::columnViewportPosition), \
|
||||
InstanceMethod("columnWidth", &WidgetWrapName::columnWidth), \
|
||||
InstanceMethod("isColumnHidden", &WidgetWrapName::isColumnHidden), \
|
||||
InstanceMethod("isRowHidden", &WidgetWrapName::isRowHidden), \
|
||||
InstanceMethod("rowAt", &WidgetWrapName::rowAt), \
|
||||
InstanceMethod("rowHeight", &WidgetWrapName::rowHeight), \
|
||||
InstanceMethod("rowSpan", &WidgetWrapName::rowSpan), \
|
||||
InstanceMethod("rowViewportPosition", \
|
||||
&WidgetWrapName::rowViewportPosition), \
|
||||
InstanceMethod("setColumnHidden", &WidgetWrapName::setColumnHidden), \
|
||||
InstanceMethod("setColumnWidth", &WidgetWrapName::setColumnWidth), \
|
||||
InstanceMethod("setRowHeight", &WidgetWrapName::setRowHeight), \
|
||||
InstanceMethod("setRowHidden", &WidgetWrapName::setRowHidden), \
|
||||
InstanceMethod("setSpan", &WidgetWrapName::setSpan), \
|
||||
InstanceMethod("hideColumn", &WidgetWrapName::hideColumn), \
|
||||
InstanceMethod("hideRow", &WidgetWrapName::hideRow), \
|
||||
InstanceMethod("resizeColumnToContents", \
|
||||
&WidgetWrapName::resizeColumnToContents), \
|
||||
InstanceMethod("resizeColumnsToContents", \
|
||||
&WidgetWrapName::resizeColumnsToContents), \
|
||||
InstanceMethod("resizeRowToContents", \
|
||||
&WidgetWrapName::resizeRowToContents), \
|
||||
InstanceMethod("resizeRowsToContents", \
|
||||
&WidgetWrapName::resizeRowsToContents), \
|
||||
InstanceMethod("selectColumn", &WidgetWrapName::selectColumn), \
|
||||
InstanceMethod("selectRow", &WidgetWrapName::selectRow), \
|
||||
InstanceMethod("showColumn", &WidgetWrapName::showColumn), \
|
||||
InstanceMethod("showRow", &WidgetWrapName::showRow), \
|
||||
InstanceMethod("sortByColumn", &WidgetWrapName::sortByColumn),
|
||||
#define QTABLEVIEW_WRAPPED_METHODS_EXPORT_DEFINE(WidgetWrapName) \
|
||||
\
|
||||
QABSTRACTITEMVIEW_WRAPPED_METHODS_EXPORT_DEFINE(WidgetWrapName) \
|
||||
\
|
||||
InstanceMethod("clearSpans", &WidgetWrapName::clearSpans), \
|
||||
InstanceMethod("columnAt", &WidgetWrapName::columnAt), \
|
||||
InstanceMethod("columnSpan", &WidgetWrapName::columnSpan), \
|
||||
InstanceMethod("columnViewportPosition", \
|
||||
&WidgetWrapName::columnViewportPosition), \
|
||||
InstanceMethod("columnWidth", &WidgetWrapName::columnWidth), \
|
||||
InstanceMethod("isColumnHidden", &WidgetWrapName::isColumnHidden), \
|
||||
InstanceMethod("isRowHidden", &WidgetWrapName::isRowHidden), \
|
||||
InstanceMethod("rowAt", &WidgetWrapName::rowAt), \
|
||||
InstanceMethod("rowHeight", &WidgetWrapName::rowHeight), \
|
||||
InstanceMethod("rowSpan", &WidgetWrapName::rowSpan), \
|
||||
InstanceMethod("rowViewportPosition", \
|
||||
&WidgetWrapName::rowViewportPosition), \
|
||||
InstanceMethod("setColumnHidden", &WidgetWrapName::setColumnHidden), \
|
||||
InstanceMethod("setColumnWidth", &WidgetWrapName::setColumnWidth), \
|
||||
InstanceMethod("setRowHeight", &WidgetWrapName::setRowHeight), \
|
||||
InstanceMethod("setRowHidden", &WidgetWrapName::setRowHidden), \
|
||||
InstanceMethod("setSpan", &WidgetWrapName::setSpan), \
|
||||
InstanceMethod("hideColumn", &WidgetWrapName::hideColumn), \
|
||||
InstanceMethod("hideRow", &WidgetWrapName::hideRow), \
|
||||
InstanceMethod("resizeColumnToContents", \
|
||||
&WidgetWrapName::resizeColumnToContents), \
|
||||
InstanceMethod("resizeColumnsToContents", \
|
||||
&WidgetWrapName::resizeColumnsToContents), \
|
||||
InstanceMethod("resizeRowToContents", \
|
||||
&WidgetWrapName::resizeRowToContents), \
|
||||
InstanceMethod("resizeRowsToContents", \
|
||||
&WidgetWrapName::resizeRowsToContents), \
|
||||
InstanceMethod("selectColumn", &WidgetWrapName::selectColumn), \
|
||||
InstanceMethod("selectRow", &WidgetWrapName::selectRow), \
|
||||
InstanceMethod("showColumn", &WidgetWrapName::showColumn), \
|
||||
InstanceMethod("showRow", &WidgetWrapName::showRow), \
|
||||
InstanceMethod("sortByColumn", &WidgetWrapName::sortByColumn), \
|
||||
InstanceMethod("horizontalHeader", &WidgetWrapName::horizontalHeader), \
|
||||
InstanceMethod("verticalHeader", &WidgetWrapName::horizontalHeader)
|
||||
|
||||
#endif // QTABLEVIEW_WRAPPED_METHODS_EXPORT_DEFINE
|
||||
|
||||
|
||||
@ -16,16 +16,21 @@
|
||||
COMPONENT_WRAPPED_METHODS_DECLARATION \
|
||||
Napi::Value initNodeEventEmitter(const Napi::CallbackInfo& info) { \
|
||||
Napi::Env env = info.Env(); \
|
||||
this->instance->emitOnNode = \
|
||||
Napi::Persistent(info[0].As<Napi::Function>()); \
|
||||
this->instance->connectSignalsToEventEmitter(); \
|
||||
EventWidget* eventWidget = \
|
||||
dynamic_cast<EventWidget*>(this->instance.data()); \
|
||||
if (eventWidget) { \
|
||||
eventWidget->emitOnNode = \
|
||||
Napi::Persistent(info[0].As<Napi::Function>()); \
|
||||
eventWidget->connectSignalsToEventEmitter(); \
|
||||
} \
|
||||
return env.Null(); \
|
||||
} \
|
||||
\
|
||||
Napi::Value getNodeEventEmitter(const Napi::CallbackInfo& info) { \
|
||||
Napi::Env env = info.Env(); \
|
||||
if (this->instance->emitOnNode) { \
|
||||
return this->instance->emitOnNode.Value(); \
|
||||
EventWidget* eventWidget = \
|
||||
dynamic_cast<EventWidget*>(this->instance.data()); \
|
||||
if (eventWidget && eventWidget->emitOnNode) { \
|
||||
return eventWidget->emitOnNode.Value(); \
|
||||
} else { \
|
||||
return env.Null(); \
|
||||
} \
|
||||
@ -33,13 +38,21 @@
|
||||
Napi::Value subscribeToQtEvent(const Napi::CallbackInfo& info) { \
|
||||
Napi::Env env = info.Env(); \
|
||||
Napi::String eventString = info[0].As<Napi::String>(); \
|
||||
this->instance->subscribeToQtEvent(eventString.Utf8Value()); \
|
||||
EventWidget* eventWidget = \
|
||||
dynamic_cast<EventWidget*>(this->instance.data()); \
|
||||
if (eventWidget) { \
|
||||
eventWidget->subscribeToQtEvent(eventString.Utf8Value()); \
|
||||
} \
|
||||
return env.Null(); \
|
||||
} \
|
||||
Napi::Value unSubscribeToQtEvent(const Napi::CallbackInfo& info) { \
|
||||
Napi::Env env = info.Env(); \
|
||||
Napi::String eventString = info[0].As<Napi::String>(); \
|
||||
this->instance->unSubscribeToQtEvent(eventString.Utf8Value()); \
|
||||
EventWidget* eventWidget = \
|
||||
dynamic_cast<EventWidget*>(this->instance.data()); \
|
||||
if (eventWidget) { \
|
||||
eventWidget->unSubscribeToQtEvent(eventString.Utf8Value()); \
|
||||
} \
|
||||
return env.Null(); \
|
||||
}
|
||||
|
||||
|
||||
@ -8,21 +8,30 @@
|
||||
*/
|
||||
|
||||
#ifndef YOGAWIDGET_WRAPPED_METHODS_DECLARATION
|
||||
#define YOGAWIDGET_WRAPPED_METHODS_DECLARATION \
|
||||
\
|
||||
Napi::Value getFlexNode(const Napi::CallbackInfo& info) { \
|
||||
YGNodeRef node = this->instance->getFlexNode(); \
|
||||
Napi::Value yogaNodeRef = Napi::External<YGNode>::New(info.Env(), node); \
|
||||
return yogaNodeRef; \
|
||||
} \
|
||||
Napi::Value setFlexNodeSizeControlled(const Napi::CallbackInfo& info) { \
|
||||
Napi::Env env = info.Env(); \
|
||||
Napi::HandleScope scope(env); \
|
||||
Napi::Boolean isSizeControlled = info[0].As<Napi::Boolean>(); \
|
||||
YGNodeRef node = this->instance->getFlexNode(); \
|
||||
FlexNodeContext* ctx = flexutils::getFlexNodeContext(node); \
|
||||
ctx->isSizeControlled = isSizeControlled.Value(); \
|
||||
return env.Null(); \
|
||||
#define YOGAWIDGET_WRAPPED_METHODS_DECLARATION \
|
||||
\
|
||||
Napi::Value getFlexNode(const Napi::CallbackInfo& info) { \
|
||||
FlexItem* item = dynamic_cast<FlexItem*>(this->instance.data()); \
|
||||
if (item) { \
|
||||
YGNodeRef node = item->getFlexNode(); \
|
||||
Napi::Value yogaNodeRef = Napi::External<YGNode>::New(info.Env(), node); \
|
||||
return yogaNodeRef; \
|
||||
} else { \
|
||||
Napi::Env env = info.Env(); \
|
||||
return env.Null(); \
|
||||
} \
|
||||
} \
|
||||
Napi::Value setFlexNodeSizeControlled(const Napi::CallbackInfo& info) { \
|
||||
Napi::Env env = info.Env(); \
|
||||
Napi::HandleScope scope(env); \
|
||||
FlexItem* item = dynamic_cast<FlexItem*>(this->instance.data()); \
|
||||
if (item) { \
|
||||
Napi::Boolean isSizeControlled = info[0].As<Napi::Boolean>(); \
|
||||
YGNodeRef node = item->getFlexNode(); \
|
||||
FlexNodeContext* ctx = flexutils::getFlexNodeContext(node); \
|
||||
ctx->isSizeControlled = isSizeControlled.Value(); \
|
||||
} \
|
||||
return env.Null(); \
|
||||
}
|
||||
|
||||
#endif // YOGAWIDGET_WRAPPED_METHODS_DECLARATION
|
||||
|
||||
61
src/cpp/lib/QtWidgets/QHeaderView/qheaderview_wrap.cpp
Normal file
61
src/cpp/lib/QtWidgets/QHeaderView/qheaderview_wrap.cpp
Normal file
@ -0,0 +1,61 @@
|
||||
#include "QtWidgets/QHeaderView/qheaderview_wrap.h"
|
||||
|
||||
#include "Extras/Utils/nutils.h"
|
||||
|
||||
Napi::FunctionReference QHeaderViewWrap::constructor;
|
||||
|
||||
Napi::Object QHeaderViewWrap::init(Napi::Env env, Napi::Object exports) {
|
||||
Napi::HandleScope scope(env);
|
||||
char CLASSNAME[] = "QHeaderView";
|
||||
Napi::Function func = DefineClass(
|
||||
env, CLASSNAME,
|
||||
{QABSTRACTITEMVIEW_WRAPPED_METHODS_EXPORT_DEFINE(QHeaderViewWrap)});
|
||||
constructor = Napi::Persistent(func);
|
||||
exports.Set(CLASSNAME, func);
|
||||
return exports;
|
||||
}
|
||||
|
||||
QHeaderView* QHeaderViewWrap::getInternalInstance() { return this->instance; }
|
||||
|
||||
QHeaderViewWrap::~QHeaderViewWrap() {
|
||||
if (!this->disableDeletion) {
|
||||
extrautils::safeDelete(this->instance);
|
||||
}
|
||||
}
|
||||
|
||||
QHeaderViewWrap::QHeaderViewWrap(const Napi::CallbackInfo& info)
|
||||
: Napi::ObjectWrap<QHeaderViewWrap>(info) {
|
||||
Napi::Env env = info.Env();
|
||||
Napi::HandleScope scope(env);
|
||||
|
||||
int len = info.Length();
|
||||
|
||||
this->disableDeletion = false;
|
||||
if (len == 1) {
|
||||
if (info[0].IsExternal()) {
|
||||
this->instance = info[0].As<Napi::External<QHeaderView>>().Data();
|
||||
this->disableDeletion = true;
|
||||
} else {
|
||||
int orientation = info[0].As<Napi::Number>().Int32Value();
|
||||
this->instance =
|
||||
new NHeaderView(static_cast<Qt::Orientation>(orientation));
|
||||
}
|
||||
} else {
|
||||
// len ==2
|
||||
int orientation = info[0].As<Napi::Number>().Int32Value();
|
||||
Napi::Object parentObject = info[1].As<Napi::Object>();
|
||||
NodeWidgetWrap* parentWidgetWrap =
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(parentObject);
|
||||
this->instance = new NHeaderView(static_cast<Qt::Orientation>(orientation),
|
||||
parentWidgetWrap->getInternalInstance());
|
||||
}
|
||||
|
||||
// this->instance can be either a `QHeaderView` or `NHeaderView`. Only
|
||||
// `NHeaderView` has the flex support available.
|
||||
this->rawData = nullptr;
|
||||
FlexItem* item = dynamic_cast<FlexItem*>(this->getInternalInstance());
|
||||
if (item) {
|
||||
this->rawData = extrautils::configureQWidget(this->getInternalInstance(),
|
||||
item->getFlexNode(), false);
|
||||
}
|
||||
}
|
||||
@ -64,6 +64,7 @@
|
||||
#include "QtWidgets/QGraphicsDropShadowEffect/qgraphicsdropshadoweffect_wrap.h"
|
||||
#include "QtWidgets/QGridLayout/qgridlayout_wrap.h"
|
||||
#include "QtWidgets/QGroupBox/qgroupbox_wrap.h"
|
||||
#include "QtWidgets/QHeaderView/qheaderview_wrap.h"
|
||||
#include "QtWidgets/QInputDialog/qinputdialog_wrap.h"
|
||||
#include "QtWidgets/QLCDNumber/qlcdnumber_wrap.h"
|
||||
#include "QtWidgets/QLabel/qlabel_wrap.h"
|
||||
@ -222,6 +223,7 @@ Napi::Object Main(Napi::Env env, Napi::Object exports) {
|
||||
QPaintEventWrap::init(env, exports);
|
||||
QPaletteWrap::init(env, exports);
|
||||
QAbstractItemModelWrap::init(env, exports);
|
||||
QHeaderViewWrap::init(env, exports);
|
||||
return exports;
|
||||
}
|
||||
|
||||
|
||||
@ -74,6 +74,7 @@ export { QToolButton, QToolButtonSignals, ToolButtonPopupMode } from './lib/QtWi
|
||||
export { QSpinBox, QSpinBoxSignals } from './lib/QtWidgets/QSpinBox';
|
||||
export { QRadioButton, QRadioButtonSignals } from './lib/QtWidgets/QRadioButton';
|
||||
export { QStackedWidget, QStackedWidgetSignals } from './lib/QtWidgets/QStackedWidget';
|
||||
export { QHeaderView, QHeaderViewSignals } from './lib/QtWidgets/QHeaderView';
|
||||
export {
|
||||
QListView,
|
||||
QListViewSignals,
|
||||
|
||||
110
src/lib/QtWidgets/QHeaderView.ts
Normal file
110
src/lib/QtWidgets/QHeaderView.ts
Normal file
@ -0,0 +1,110 @@
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { QAbstractItemView, QAbstractItemViewSignals } from './QAbstractItemView';
|
||||
import { checkIfNativeElement, Orientation } from '../..';
|
||||
|
||||
/**
|
||||
|
||||
> The QHeaderView class provides a header row or header column for item views.
|
||||
|
||||
* **This class is a JS wrapper around Qt's [QHeaderView class](https://doc.qt.io/qt-5/qheaderview.html)**
|
||||
|
||||
*/
|
||||
export abstract class NodeHeaderView<Signals extends QHeaderViewSignals> extends QAbstractItemView<Signals> {
|
||||
// *** Public Function ***
|
||||
// TODO: bool cascadingSectionResizes() const
|
||||
// TODO: int count() const
|
||||
// TODO: Qt::Alignment defaultAlignment() const
|
||||
// TODO: int defaultSectionSize() const
|
||||
// TODO: int hiddenSectionCount() const
|
||||
// TODO: void hideSection(int logicalIndex)
|
||||
// TODO: bool highlightSections() const
|
||||
// TODO: bool isFirstSectionMovable() const
|
||||
// TODO: bool isSectionHidden(int logicalIndex) const
|
||||
// TODO: bool isSortIndicatorShown() const
|
||||
// TODO: int length() const
|
||||
// TODO: int logicalIndex(int visualIndex) const
|
||||
// TODO: int logicalIndexAt(int position) const
|
||||
// TODO: int logicalIndexAt(int x, int y) const
|
||||
// TODO: int logicalIndexAt(const QPoint &pos) const
|
||||
// TODO: int maximumSectionSize() const
|
||||
// TODO: int minimumSectionSize() const
|
||||
// TODO: void moveSection(int from, int to)
|
||||
// TODO: int offset() const
|
||||
// TODO: Qt::Orientation orientation() const
|
||||
// TODO: void resetDefaultSectionSize()
|
||||
// TODO: int resizeContentsPrecision() const
|
||||
// TODO: void resizeSection(int logicalIndex, int size)
|
||||
// TODO: void resizeSections(QHeaderView::ResizeMode mode)
|
||||
// TODO: bool restoreState(const QByteArray &state)
|
||||
// TODO: QByteArray saveState() const
|
||||
// TODO: int sectionPosition(int logicalIndex) const
|
||||
// TODO: QHeaderView::ResizeMode sectionResizeMode(int logicalIndex) const
|
||||
// TODO: int sectionSize(int logicalIndex) const
|
||||
// TODO: int sectionSizeHint(int logicalIndex) const
|
||||
// TODO: int sectionViewportPosition(int logicalIndex) const
|
||||
// TODO: bool sectionsClickable() const
|
||||
// TODO: bool sectionsHidden() const
|
||||
// TODO: bool sectionsMovable() const
|
||||
// TODO: bool sectionsMoved() const
|
||||
// TODO: void setCascadingSectionResizes(bool enable)
|
||||
// TODO: void setDefaultAlignment(Qt::Alignment alignment)
|
||||
// TODO: void setDefaultSectionSize(int size)
|
||||
// TODO: void setFirstSectionMovable(bool movable)
|
||||
// TODO: void setHighlightSections(bool highlight)
|
||||
// TODO: void setMaximumSectionSize(int size)
|
||||
// TODO: void setMinimumSectionSize(int size)
|
||||
// TODO: void setResizeContentsPrecision(int precision)
|
||||
// TODO: void setSectionHidden(int logicalIndex, bool hide)
|
||||
// TODO: void setSectionResizeMode(QHeaderView::ResizeMode mode)
|
||||
// TODO: void setSectionResizeMode(int logicalIndex, QHeaderView::ResizeMode mode)
|
||||
// TODO: void setSectionsClickable(bool clickable)
|
||||
// TODO: void setSectionsMovable(bool movable)
|
||||
// TODO: void setSortIndicator(int logicalIndex, Qt::SortOrder order)
|
||||
// TODO: void setSortIndicatorShown(bool show)
|
||||
|
||||
setStretchLastSection(stretch: boolean): void {
|
||||
this.setProperty('stretchLastSection', stretch);
|
||||
}
|
||||
|
||||
// TODO: void showSection(int logicalIndex)
|
||||
// TODO: Qt::SortOrder sortIndicatorOrder() const
|
||||
// TODO: int sortIndicatorSection() const
|
||||
|
||||
stretchLastSection(): boolean {
|
||||
return this.property('stretchLastSection').toBool();
|
||||
}
|
||||
|
||||
// TODO: int stretchSectionCount() const
|
||||
// TODO: void swapSections(int first, int second)
|
||||
// TODO: int visualIndex(int logicalIndex) const
|
||||
// TODO: int visualIndexAt(int position) const
|
||||
|
||||
// *** Public Slots ***
|
||||
// TODO: void headerDataChanged(Qt::Orientation orientation, int logicalFirst, int logicalLast)
|
||||
// TODO: void setOffset(int offset)
|
||||
// TODO: void setOffsetToLastSection()
|
||||
// TODO: void setOffsetToSectionPosition(int visualSectionNumber)
|
||||
}
|
||||
|
||||
export class QHeaderView extends NodeHeaderView<QHeaderViewSignals> {
|
||||
native: NativeElement;
|
||||
constructor(orientationOrNative: Orientation | NativeElement, parent: NodeWidget<any> | null = null) {
|
||||
let native;
|
||||
if (checkIfNativeElement(orientationOrNative)) {
|
||||
native = orientationOrNative as NativeElement;
|
||||
} else {
|
||||
if (parent != null) {
|
||||
native = new addon.QHeaderView(orientationOrNative, parent.native);
|
||||
} else {
|
||||
native = new addon.QHeaderView(orientationOrNative);
|
||||
}
|
||||
}
|
||||
super(native);
|
||||
this.native = native;
|
||||
parent && this.setNodeParent(parent);
|
||||
}
|
||||
}
|
||||
|
||||
export type QHeaderViewSignals = QAbstractItemViewSignals;
|
||||
@ -3,9 +3,10 @@ import { NodeWidget } from './QWidget';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { SortOrder, PenStyle } from '../QtEnums';
|
||||
import { QAbstractItemView, QAbstractItemViewSignals } from './QAbstractItemView';
|
||||
import { QHeaderView } from './QHeaderView';
|
||||
|
||||
/**
|
||||
|
||||
|
||||
> The QTableView class provides a default model/view implementation of a table view.
|
||||
|
||||
* **This class is a JS wrapper around Qt's [QTableView class](https://doc.qt.io/qt-5/qtableview.html)**
|
||||
@ -20,84 +21,121 @@ const tableview = new QTableView();
|
||||
```
|
||||
*/
|
||||
export abstract class NodeTableView<Signals extends QTableViewSignals> extends QAbstractItemView<Signals> {
|
||||
setCornerButtonEnabled(enable: boolean): void {
|
||||
this.setProperty('cornerButtonEnabled', enable);
|
||||
}
|
||||
isCornerButtonEnabled(): boolean {
|
||||
return this.property('cornerButtonEnabled').toBool();
|
||||
}
|
||||
setGridStyle(style: PenStyle): void {
|
||||
this.setProperty('gridStyle', style);
|
||||
}
|
||||
gridStyle(): PenStyle {
|
||||
return this.property('gridStyle').toInt();
|
||||
}
|
||||
setShowGrid(show: boolean): void {
|
||||
this.setProperty('showGrid', show);
|
||||
}
|
||||
showGrid(): boolean {
|
||||
return this.property('showGrid').toBool();
|
||||
}
|
||||
setSortingEnabled(enable: boolean): void {
|
||||
this.setProperty('sortingEnabled', enable);
|
||||
}
|
||||
isSortingEnabled(): boolean {
|
||||
return this.property('sortingEnabled').toBool();
|
||||
}
|
||||
setWordWrap(on: boolean): void {
|
||||
this.setProperty('wordWrap', on);
|
||||
}
|
||||
wordWrap(): boolean {
|
||||
return this.property('wordWrap').toBool();
|
||||
}
|
||||
// *** Public Functions ***
|
||||
clearSpans(): void {
|
||||
this.native.clearSpans();
|
||||
}
|
||||
|
||||
columnAt(x: number): number {
|
||||
return this.native.columnAt(x);
|
||||
}
|
||||
|
||||
columnSpan(row: number, column: number): number {
|
||||
return this.native.columnSpan(row, column);
|
||||
}
|
||||
|
||||
columnViewportPosition(column: number): number {
|
||||
return this.native.columnViewportPosition(column);
|
||||
}
|
||||
setColumnWidth(column: number, width: number): void {
|
||||
this.native.setColumnWidth(column, width);
|
||||
}
|
||||
|
||||
columnWidth(column: number): number {
|
||||
return this.native.columnWidth(column);
|
||||
}
|
||||
setColumnHidden(column: number, hide: boolean): void {
|
||||
this.native.setColumnHidden(column, hide);
|
||||
|
||||
gridStyle(): PenStyle {
|
||||
return this.property('gridStyle').toInt();
|
||||
}
|
||||
|
||||
horizontalHeader(): QHeaderView {
|
||||
return new QHeaderView(this.native.horizontalHeader());
|
||||
}
|
||||
|
||||
isColumnHidden(column: number): boolean {
|
||||
return this.native.isColumnHidden(column);
|
||||
}
|
||||
setRowHidden(row: number, hide: boolean): void {
|
||||
this.native.setRowHidden(row, hide);
|
||||
|
||||
isCornerButtonEnabled(): boolean {
|
||||
return this.property('cornerButtonEnabled').toBool();
|
||||
}
|
||||
|
||||
isRowHidden(row: number): boolean {
|
||||
return this.native.isRowHidden(row);
|
||||
}
|
||||
|
||||
isSortingEnabled(): boolean {
|
||||
return this.property('sortingEnabled').toBool();
|
||||
}
|
||||
|
||||
rowAt(y: number): number {
|
||||
return this.native.rowAt(y);
|
||||
}
|
||||
setRowHeight(row: number, height: number): void {
|
||||
this.native.setRowHeight(row, height);
|
||||
}
|
||||
|
||||
rowHeight(row: number): number {
|
||||
return this.native.rowHeight(row);
|
||||
}
|
||||
|
||||
rowSpan(row: number, column: number): number {
|
||||
return this.native.rowSpan(row, column);
|
||||
}
|
||||
|
||||
rowViewportPosition(row: number): number {
|
||||
return this.native.rowViewportPosition(row);
|
||||
}
|
||||
|
||||
setColumnHidden(column: number, hide: boolean): void {
|
||||
this.native.setColumnHidden(column, hide);
|
||||
}
|
||||
|
||||
setColumnWidth(column: number, width: number): void {
|
||||
this.native.setColumnWidth(column, width);
|
||||
}
|
||||
|
||||
setCornerButtonEnabled(enable: boolean): void {
|
||||
this.setProperty('cornerButtonEnabled', enable);
|
||||
}
|
||||
|
||||
setGridStyle(style: PenStyle): void {
|
||||
this.setProperty('gridStyle', style);
|
||||
}
|
||||
|
||||
// TODO: void setHorizontalHeader(QHeaderView *header)
|
||||
|
||||
setRowHeight(row: number, height: number): void {
|
||||
this.native.setRowHeight(row, height);
|
||||
}
|
||||
|
||||
setRowHidden(row: number, hide: boolean): void {
|
||||
this.native.setRowHidden(row, hide);
|
||||
}
|
||||
|
||||
setSortingEnabled(enable: boolean): void {
|
||||
this.setProperty('sortingEnabled', enable);
|
||||
}
|
||||
|
||||
setSpan(row: number, column: number, rowSpanCount: number, columnSpanCount: number): void {
|
||||
this.native.setSpan(row, column, rowSpanCount, columnSpanCount);
|
||||
}
|
||||
|
||||
// TODO: void setVerticalHeader(QHeaderView *header)
|
||||
|
||||
setWordWrap(on: boolean): void {
|
||||
this.setProperty('wordWrap', on);
|
||||
}
|
||||
|
||||
showGrid(): boolean {
|
||||
return this.property('showGrid').toBool();
|
||||
}
|
||||
|
||||
verticalHeader(): QHeaderView {
|
||||
return new QHeaderView(this.native.verticalHeader());
|
||||
}
|
||||
|
||||
wordWrap(): boolean {
|
||||
return this.property('wordWrap').toBool();
|
||||
}
|
||||
|
||||
// *** Public Slots ***
|
||||
|
||||
hideColumn(column: number): void {
|
||||
this.native.hideColumn(column);
|
||||
}
|
||||
@ -122,12 +160,19 @@ export abstract class NodeTableView<Signals extends QTableViewSignals> extends Q
|
||||
selectRow(row: number): void {
|
||||
this.native.selectRow(row);
|
||||
}
|
||||
|
||||
setShowGrid(show: boolean): void {
|
||||
this.setProperty('showGrid', show);
|
||||
}
|
||||
|
||||
showColumn(column: number): void {
|
||||
this.native.showColumn(column);
|
||||
}
|
||||
|
||||
showRow(row: number): void {
|
||||
this.native.showRow(row);
|
||||
}
|
||||
|
||||
sortByColumn(column: number, order: SortOrder): void {
|
||||
this.native.sortByColumn(column, order);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user