#include <QApplication>
#include <QTreeView>
#include <QStandardItemModel>
int main(int argc, char *argv[])
{
for (int row = 0; row < 20; ++row) {
for (int column = 0; column < 4; ++column) {
model.setItem(row, column, item);
}
}
v.setModel(&model);
v.setStyleSheet(
" QScrollBar:vertical {"
" border: 2px solid grey;"
" background: #32CC99;"
" width: 15px;"
" margin: 22px 0px 22px 0px;"
" }"
" QScrollBar::handle:vertical {"
" border: 2px solid red;"
" background: #ffffff;"
" min-height: 20px;"
" }"
" QScrollBar::add-line:vertical {"
" border: 2px solid grey;"
" background: #32CC99;"
" height: 20px;"
" subcontrol-position: bottom;"
" subcontrol-origin: margin;"
" }"
" QScrollBar::sub-line:vertical {"
" border: 2px solid grey;"
" background: #32CC99;"
" height: 20px;"
" subcontrol-position: top;"
" subcontrol-origin: margin;"
" }"
" QScrollBar::up-arrow:vertical, QScrollBar::down-arrow:vertical {"
" border: 2px solid grey;"
" width: 3px;"
" height: 3px;"
" background: white;"
" }"
" QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {"
" background: none;"
" } "
);
v.show();
return app.exec();
}
#include <QApplication>
#include <QTreeView>
#include <QStandardItemModel>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QStandardItemModel model(20, 4);
for (int row = 0; row < 20; ++row) {
for (int column = 0; column < 4; ++column) {
QStandardItem *item = new QStandardItem(QString("row %0, column %1").arg(row).arg(column));
model.setItem(row, column, item);
}
}
QTreeView v;
v.setModel(&model);
v.setStyleSheet(
" QScrollBar:vertical {"
" border: 2px solid grey;"
" background: #32CC99;"
" width: 15px;"
" margin: 22px 0px 22px 0px;"
" }"
" QScrollBar::handle:vertical {"
" border: 2px solid red;"
" background: #ffffff;"
" min-height: 20px;"
" }"
" QScrollBar::add-line:vertical {"
" border: 2px solid grey;"
" background: #32CC99;"
" height: 20px;"
" subcontrol-position: bottom;"
" subcontrol-origin: margin;"
" }"
" QScrollBar::sub-line:vertical {"
" border: 2px solid grey;"
" background: #32CC99;"
" height: 20px;"
" subcontrol-position: top;"
" subcontrol-origin: margin;"
" }"
" QScrollBar::up-arrow:vertical, QScrollBar::down-arrow:vertical {"
" border: 2px solid grey;"
" width: 3px;"
" height: 3px;"
" background: white;"
" }"
" QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {"
" background: none;"
" } "
);
v.show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks