Remove the workaoround from QTableView, made stretching default

This commit is contained in:
Klaus Basan
2019-04-24 23:57:56 +02:00
parent 95bcd4c15b
commit d32e596c89
2 changed files with 16 additions and 4 deletions

View File

@@ -557,7 +557,7 @@ namespace BlackGui
int m_skipResizeThreshold = 40; //!< when to skip resize (rows count)
int m_resizeAutoNthTime = 1; //!< with ResizeAuto, resize every n-th time
int m_loadIndicatorTimeoutMsDefault = 30 * 1000; //!< default time for timeout
bool m_forceStretchLastColumnWhenResized = false; //!< a small table might (few columns) might to fail stretching, force again
bool m_forceStretchLastColumnWhenResized = true; //!< a small table might (few columns) fail stretching, force again
bool m_showingLoadIndicator = false; //!< showing loading indicator
bool m_enabledLoadIndicator = true; //!< loading indicator enabled/disabled
bool m_acceptClickSelection = false; //!< clicked

View File

@@ -760,6 +760,10 @@ namespace BlackGui
void CViewBaseNonTemplate::fullResizeToContents()
{
//! \fixme 2019-04 Disabled the magic FOO trick for resizing
//! Not working anymore and NOT needed ??? anymore, seems like
/**
// resize to maximum magic trick from:
// http://stackoverflow.com/q/3433664/356726
this->setVisible(false);
@@ -773,6 +777,7 @@ namespace BlackGui
vpNew.setWidth(screenGeometry.width());
this->viewport()->setGeometry(vpNew);
}
**/
this->resizeColumnsToContents(); // columns
@@ -784,12 +789,19 @@ namespace BlackGui
m_resizeCount++;
// re-stretch
if (m_forceStretchLastColumnWhenResized) { this->horizontalHeader()->setStretchLastSection(true); }
if (m_forceColumnsToMaxSize) { this->viewport()->setGeometry(vpOriginal); }
if (m_forceStretchLastColumnWhenResized)
{
// toggling forces the stretch, otherwise not working
this->horizontalHeader()->setStretchLastSection(false);
this->horizontalHeader()->setStretchLastSection(true);
}
/** Magic FOO
// if (m_forceColumnsToMaxSize) { this->viewport()->setGeometry(vpOriginal); }
// if I store the original visibility and then
// set it back here, the whole view disappears
this->setVisible(true);
// this->setVisible(true);
**/
}
void CViewBaseNonTemplate::customMenuRequested(const QPoint &pos)