命名规范
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
#include "Base_Table_Data.h"
|
||||
#include "Table_View.h"
|
||||
#include "Renderive/Generate_Mock_Data.h"
|
||||
namespace Psc {
|
||||
Base_Table_Data::Base_Table_Data() {
|
||||
parent = this;
|
||||
}
|
||||
Table_Paint_Data::Table_Paint_Data(QIcon ic, QString t) {
|
||||
renderive::Range r{155, 255};
|
||||
QColor random_color(renderive::get_data(r), renderive::get_data(r), renderive::get_data(r));
|
||||
background_color = random_color;
|
||||
icon = Icon2(ic);
|
||||
text.text = t;
|
||||
layout.items.append(&icon.value());
|
||||
layout.items.append(&text);
|
||||
}
|
||||
Table_Paint_Data::Table_Paint_Data(QString t) {
|
||||
renderive::Range r{155, 255};
|
||||
QColor random_color(renderive::get_data(r), renderive::get_data(r), renderive::get_data(r));
|
||||
background_color = random_color;
|
||||
text.text = t;
|
||||
layout.items.append(&text);
|
||||
}
|
||||
void Table_Paint_Data::update(bool show, Table_View* view, QPainter* painter, QRect rect) {
|
||||
painter->fillRect(rect, background_color);
|
||||
layout.set_x(rect.left());
|
||||
layout.set_y(rect.top());
|
||||
layout.set_w(rect.width());
|
||||
layout.set_h(rect.height());
|
||||
layout.layout();
|
||||
text.paint(painter, text.rect(), nullptr);
|
||||
if (icon.has_value()) {
|
||||
icon.value().paint(painter, icon.value().rect(), nullptr);
|
||||
}
|
||||
// painter->drawText(text.rect(), Qt::AlignCenter, text.text);
|
||||
}
|
||||
void Widget_Data::update(bool show, Table_View* view, QPainter* painter, QRect rect) {
|
||||
// auto tl = view->to_inside_pos(rect.topLeft());
|
||||
// auto br = view->to_inside_pos(rect.bottomRight());
|
||||
auto tl = rect.topLeft() - view->get_view_rect().topLeft();
|
||||
auto br = tl + QPoint(rect.width(), rect.height());
|
||||
QRect r(tl, br);
|
||||
// qDebug() << r << "\n";
|
||||
if (show) {
|
||||
widget->setParent(view->container);
|
||||
widget->show();
|
||||
widget->installEventFilter(view);
|
||||
widget->setGeometry(r);
|
||||
}
|
||||
else {
|
||||
widget->setParent(nullptr);
|
||||
widget->hide();
|
||||
widget->removeEventFilter(view);
|
||||
}
|
||||
}
|
||||
} // namespace Psc
|
||||
Reference in New Issue
Block a user