/** * @brief GenreWidget::GenreWidget * @param parent */ GenreWidget::GenreWidget(QWidget *parent) : QWidget(parent), ui(new Ui::GenreWidget) { ui->setupUi(this); ui->genres->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents); ui->movies->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents); QFont font = ui->genreName->font(); font.setPointSize(font.pointSize()+4); ui->genreName->setFont(font); #ifdef Q_WS_MAC QFont genresFont = ui->genres->font(); genresFont.setPointSize(genresFont.pointSize()-2); ui->genres->setFont(genresFont); #endif ui->genres->setContextMenuPolicy(Qt::CustomContextMenu); m_tableContextMenu = new QMenu(ui->genres); QAction *actionDeleteGenre = new QAction(tr("Delete Genre"), this); m_tableContextMenu->addAction(actionDeleteGenre); connect(actionDeleteGenre, SIGNAL(triggered()), this, SLOT(deleteGenre())); connect(ui->genres, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showGenresContextMenu(QPoint))); connect(ui->genres, SIGNAL(itemSelectionChanged()), this, SLOT(onGenreSelected())); connect(ui->genres, SIGNAL(itemChanged(QTableWidgetItem*)), this, SLOT(onGenreNameChanged(QTableWidgetItem*))); }
/** * @brief GenreWidget::GenreWidget * @param parent */ GenreWidget::GenreWidget(QWidget *parent) : QWidget(parent), ui(new Ui::GenreWidget) { ui->setupUi(this); ui->genres->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); ui->movies->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); #ifdef Q_OS_MAC QFont genresFont = ui->genres->font(); genresFont.setPointSize(genresFont.pointSize()-2); ui->genres->setFont(genresFont); #endif #ifndef Q_OS_MAC QFont nameFont = ui->genreName->font(); nameFont.setPointSize(nameFont.pointSize()-4); ui->genreName->setFont(nameFont); #endif ui->genres->setContextMenuPolicy(Qt::CustomContextMenu); m_tableContextMenu = new QMenu(ui->genres); QAction *actionAddGenre = new QAction(tr("Add Genre"), this); QAction *actionDeleteGenre = new QAction(tr("Delete Genre"), this); m_tableContextMenu->addAction(actionAddGenre); m_tableContextMenu->addAction(actionDeleteGenre); connect(actionAddGenre, SIGNAL(triggered()), this, SLOT(addGenre())); connect(actionDeleteGenre, SIGNAL(triggered()), this, SLOT(deleteGenre())); connect(ui->genres, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showGenresContextMenu(QPoint))); connect(ui->movies, SIGNAL(itemDoubleClicked(QTableWidgetItem*)), this, SLOT(onJumpToMovie(QTableWidgetItem*))); connect(ui->genres, SIGNAL(itemSelectionChanged()), this, SLOT(onGenreSelected())); connect(ui->genres, SIGNAL(itemChanged(QTableWidgetItem*)), this, SLOT(onGenreNameChanged(QTableWidgetItem*))); Helper::instance()->applyStyle(ui->genres); Helper::instance()->applyStyle(ui->groupBox); Helper::instance()->applyStyle(ui->label_2); Helper::instance()->applyStyle(ui->label_3); }