void DateTimeGrid::paintUserDefinedHeader( QPainter* painter, const QRectF& headerRect, const QRectF& exposedRect, qreal offset, const KDGantt::DateTimeScaleFormatter* formatter, QWidget* widget) { const QStyle* const style = widget ? widget->style() : QApplication::style(); QDateTime dt = formatter->currentRangeBegin( mapToDateTime( offset + exposedRect.left() ) ).toUTC(); qreal x =
| 249 | } |
| 250 | */ |
| 251 | MainWindow::MainWindow(QWidget *parent) |
| 252 | : QMainWindow(parent) |
| 253 | , m_model(new ProjectModel(this)) |
| 254 | , m_view(new KDGantt::View) |
| 255 | { |
| 256 | m_view->setModel(m_model); |
| 257 | m_view->setSelectionModel(new QItemSelectionModel(m_model)); |
| 258 | |
| 259 | // slotToolsNewItem(); |
| 260 | m_view->leftView()->setItemDelegateForColumn(1, new MyItemDelegate(this)); |
| 261 | m_view->leftView()->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); |
| 262 | m_view->graphicsView()->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); |
| 263 | |
| 264 | m_view->setGrid(new DateTimeGrid(this)); |
| 265 | |
| 266 | // QItemEditorCreatorBase *creator = new QItemEditorCreator<ItemTypeComboBox>("itemType"); |
| 267 | // QItemEditorFactory* factory = new QItemEditorFactory; |
| 268 | // factory->registerEditor( QVariant( KDGantt::TypeTask ).type(), creator ); |
| 269 | // m_view->itemDelegate()->setItemEditorFactory( factory ); |
| 270 | |
| 271 | setCentralWidget(m_view); |
| 272 | |
| 273 | QMenuBar *mb = menuBar(); |
| 274 | |
| 275 | auto *fileMenu = new QMenu(tr("&File")); |
| 276 | |
| 277 | #ifndef QT_NO_PRINTER |
| 278 | fileMenu->addAction(tr("&Save as PDF..."), this, SLOT(slotFileSavePdf())); |
| 279 | fileMenu->addAction(tr("&Print..."), this, SLOT(slotFilePrint())); |
| 280 | #endif |
| 281 | |
| 282 | fileMenu->addSeparator(); |
| 283 | fileMenu->addAction(tr("&Quit"), this, SLOT(slotFileQuit())); |
| 284 | |
| 285 | mb->addMenu(fileMenu); |
| 286 | |
| 287 | auto *toolsMenu = new QMenu(tr("&Tools")); |
| 288 | |
| 289 | toolsMenu->addAction(tr("&New Item"), this, SLOT(slotToolsNewItem())); |
| 290 | toolsMenu->addAction(tr("&Add Item"), this, SLOT(slotToolsAppendItem())); |
| 291 | toolsMenu->addSeparator(); |
| 292 | QMenu *alignMenu = toolsMenu->addMenu(tr("Ali&gn")); |
| 293 | alignMenu->addAction(tr("&Left"), this, SLOT(slotAlignLeft())); |
| 294 | alignMenu->addAction(tr("&Center"), this, SLOT(slotAlignCenter())); |
| 295 | alignMenu->addAction(tr("&Right"), this, SLOT(slotAlignRight())); |
| 296 | alignMenu->addAction(tr("&Hidden"), this, SLOT(slotAlignHidden())); |
| 297 | toolsMenu->addSeparator(); |
| 298 | toolsMenu->addAction(tr("&Collapse All"), this, SLOT(slotCollapseAll())); |
| 299 | toolsMenu->addAction(tr("&Expand All"), this, SLOT(slotExpandAll())); |
| 300 | |
| 301 | mb->addMenu(toolsMenu); |
| 302 | |
| 303 | /* |
| 304 | slotToolsNewItem(); |
| 305 | slotToolsNewItem(); |
| 306 | slotToolsNewItem(); |
| 307 | for (int i = 0; i < 3; ++i) { |
| 308 | m_model->setData(m_model->index(i,2,QModelIndex()), QVariant::fromValue(QDateTime::currentDateTime().addDays(i)), KDGantt::StartTimeRole); |
nothing calls this directly
no test coverage detected