fix: email selection in table view + responsive filter bar
- Connect currentRowChanged to onRowSelected so single-click in table shows email in reader - Add responsive filter bar: hide groupBy/displayMode/pivot combos progressively as width decreases - Set Fixed size policy on combos to prevent unwanted stretching - Reduced filter layout spacing from 12 to 8px
This commit is contained in:
+28
-1
@@ -72,24 +72,29 @@ void MailListView::setupUI()
|
|||||||
QWidget *filterBar = new QWidget();
|
QWidget *filterBar = new QWidget();
|
||||||
filterBar->setFixedHeight(36);
|
filterBar->setFixedHeight(36);
|
||||||
filterBar->setStyleSheet("background-color: #f5f5f7; border-bottom: 1px solid #d1d1d6;");
|
filterBar->setStyleSheet("background-color: #f5f5f7; border-bottom: 1px solid #d1d1d6;");
|
||||||
|
filterBar->setObjectName("filterBar");
|
||||||
QHBoxLayout *filterLayout = new QHBoxLayout(filterBar);
|
QHBoxLayout *filterLayout = new QHBoxLayout(filterBar);
|
||||||
filterLayout->setContentsMargins(12, 2, 12, 2);
|
filterLayout->setContentsMargins(12, 2, 12, 2);
|
||||||
filterLayout->setSpacing(12);
|
filterLayout->setSpacing(8);
|
||||||
|
|
||||||
m_unreadOnlyCheck = new QCheckBox("No leídos");
|
m_unreadOnlyCheck = new QCheckBox("No leídos");
|
||||||
m_unreadOnlyCheck->setStyleSheet("QCheckBox { font-size: 12px; color: #333; }");
|
m_unreadOnlyCheck->setStyleSheet("QCheckBox { font-size: 12px; color: #333; }");
|
||||||
|
m_unreadOnlyCheck->setObjectName("filterCheck");
|
||||||
filterLayout->addWidget(m_unreadOnlyCheck);
|
filterLayout->addWidget(m_unreadOnlyCheck);
|
||||||
|
|
||||||
m_flaggedOnlyCheck = new QCheckBox("Marcados");
|
m_flaggedOnlyCheck = new QCheckBox("Marcados");
|
||||||
m_flaggedOnlyCheck->setStyleSheet("QCheckBox { font-size: 12px; color: #333; }");
|
m_flaggedOnlyCheck->setStyleSheet("QCheckBox { font-size: 12px; color: #333; }");
|
||||||
|
m_flaggedOnlyCheck->setObjectName("filterCheck");
|
||||||
filterLayout->addWidget(m_flaggedOnlyCheck);
|
filterLayout->addWidget(m_flaggedOnlyCheck);
|
||||||
|
|
||||||
m_hasAttachmentsCheck = new QCheckBox("Con adjuntos");
|
m_hasAttachmentsCheck = new QCheckBox("Con adjuntos");
|
||||||
m_hasAttachmentsCheck->setStyleSheet("QCheckBox { font-size: 12px; color: #333; }");
|
m_hasAttachmentsCheck->setStyleSheet("QCheckBox { font-size: 12px; color: #333; }");
|
||||||
|
m_hasAttachmentsCheck->setObjectName("filterCheck");
|
||||||
filterLayout->addWidget(m_hasAttachmentsCheck);
|
filterLayout->addWidget(m_hasAttachmentsCheck);
|
||||||
|
|
||||||
m_pinnedOnlyCheck = new QCheckBox("Solo fijados");
|
m_pinnedOnlyCheck = new QCheckBox("Solo fijados");
|
||||||
m_pinnedOnlyCheck->setStyleSheet("QCheckBox { font-size: 12px; color: #333; }");
|
m_pinnedOnlyCheck->setStyleSheet("QCheckBox { font-size: 12px; color: #333; }");
|
||||||
|
m_pinnedOnlyCheck->setObjectName("filterCheck");
|
||||||
filterLayout->addWidget(m_pinnedOnlyCheck);
|
filterLayout->addWidget(m_pinnedOnlyCheck);
|
||||||
|
|
||||||
filterLayout->addStretch();
|
filterLayout->addStretch();
|
||||||
@@ -99,6 +104,7 @@ void MailListView::setupUI()
|
|||||||
m_pivotCombo->addItem("Principal"); // Focused
|
m_pivotCombo->addItem("Principal"); // Focused
|
||||||
m_pivotCombo->addItem("Otros"); // Other
|
m_pivotCombo->addItem("Otros"); // Other
|
||||||
m_pivotCombo->setFixedWidth(140);
|
m_pivotCombo->setFixedWidth(140);
|
||||||
|
m_pivotCombo->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||||
m_pivotCombo->setStyleSheet(
|
m_pivotCombo->setStyleSheet(
|
||||||
"QComboBox { border: 1px solid #d1d1d6; border-radius: 4px; padding: 4px 8px; "
|
"QComboBox { border: 1px solid #d1d1d6; border-radius: 4px; padding: 4px 8px; "
|
||||||
"background: white; min-height: 20px; }"
|
"background: white; min-height: 20px; }"
|
||||||
@@ -116,6 +122,7 @@ void MailListView::setupUI()
|
|||||||
m_displayModeCombo->addItem("Medio");
|
m_displayModeCombo->addItem("Medio");
|
||||||
m_displayModeCombo->addItem("Espacioso");
|
m_displayModeCombo->addItem("Espacioso");
|
||||||
m_displayModeCombo->setFixedWidth(120);
|
m_displayModeCombo->setFixedWidth(120);
|
||||||
|
m_displayModeCombo->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||||
m_displayModeCombo->setStyleSheet(
|
m_displayModeCombo->setStyleSheet(
|
||||||
"QComboBox { border: 1px solid #d1d1d6; border-radius: 4px; padding: 4px 8px; "
|
"QComboBox { border: 1px solid #d1d1d6; border-radius: 4px; padding: 4px 8px; "
|
||||||
"background: white; min-height: 20px; }"
|
"background: white; min-height: 20px; }"
|
||||||
@@ -133,6 +140,7 @@ void MailListView::setupUI()
|
|||||||
m_groupByCombo->addItem("Agrupar por conversación");
|
m_groupByCombo->addItem("Agrupar por conversación");
|
||||||
m_groupByCombo->addItem("Agrupar por remitente");
|
m_groupByCombo->addItem("Agrupar por remitente");
|
||||||
m_groupByCombo->setFixedWidth(180);
|
m_groupByCombo->setFixedWidth(180);
|
||||||
|
m_groupByCombo->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||||
m_groupByCombo->setStyleSheet(
|
m_groupByCombo->setStyleSheet(
|
||||||
"QComboBox { border: 1px solid #d1d1d6; border-radius: 4px; padding: 4px 8px; "
|
"QComboBox { border: 1px solid #d1d1d6; border-radius: 4px; padding: 4px 8px; "
|
||||||
"background: white; min-height: 20px; }"
|
"background: white; min-height: 20px; }"
|
||||||
@@ -249,6 +257,9 @@ void MailListView::setupUI()
|
|||||||
|
|
||||||
connect(m_treeView->selectionModel(), &QItemSelectionModel::selectionChanged,
|
connect(m_treeView->selectionModel(), &QItemSelectionModel::selectionChanged,
|
||||||
this, &MailListView::onSelectionChanged);
|
this, &MailListView::onSelectionChanged);
|
||||||
|
// Single-click selection in tree view -> emit emailSelected for reader pane
|
||||||
|
connect(m_treeView->selectionModel(), &QItemSelectionModel::currentRowChanged,
|
||||||
|
this, &MailListView::onRowSelected);
|
||||||
connect(m_treeView, &QTreeView::doubleClicked, this, [this](const QModelIndex &index) {
|
connect(m_treeView, &QTreeView::doubleClicked, this, [this](const QModelIndex &index) {
|
||||||
if (!index.isValid()) return;
|
if (!index.isValid()) return;
|
||||||
QModelIndex proxyIdx = m_proxyModel->mapToSource(index);
|
QModelIndex proxyIdx = m_proxyModel->mapToSource(index);
|
||||||
@@ -385,6 +396,22 @@ void MailListView::updateViewMode()
|
|||||||
m_treeView->header()->show();
|
m_treeView->header()->show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Also update filter bar responsiveness
|
||||||
|
updateFilterBarVisibility(viewportWidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MailListView::updateFilterBarVisibility(int viewportWidth)
|
||||||
|
{
|
||||||
|
// Hide controls progressively as width decreases
|
||||||
|
// Thresholds: show all > 900px, hide groupBy > 750px, hide displayMode > 600px, hide pivot > 500px
|
||||||
|
bool showGroupBy = viewportWidth > 750;
|
||||||
|
bool showDisplayMode = viewportWidth > 600;
|
||||||
|
bool showPivot = viewportWidth > 500;
|
||||||
|
|
||||||
|
m_groupByCombo->setVisible(showGroupBy);
|
||||||
|
m_displayModeCombo->setVisible(showDisplayMode);
|
||||||
|
m_pivotCombo->setVisible(showPivot && m_pivotCombo->isVisible()); // respect folder-type visibility
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<int> MailListView::getSelectedMailIds() const
|
QVector<int> MailListView::getSelectedMailIds() const
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ private:
|
|||||||
void setupUI();
|
void setupUI();
|
||||||
void refreshViews();
|
void refreshViews();
|
||||||
void updateViewMode();
|
void updateViewMode();
|
||||||
|
void updateFilterBarVisibility(int viewportWidth); // New: responsive filter bar
|
||||||
void updateActionBar();
|
void updateActionBar();
|
||||||
QVector<int> getSelectedMailIds() const;
|
QVector<int> getSelectedMailIds() const;
|
||||||
void initDrag();
|
void initDrag();
|
||||||
|
|||||||
Reference in New Issue
Block a user