Dynamic size for color selection and compile warning fixes (#380)

This commit is contained in:
Marco Grassi 2018-03-11 18:29:37 +08:00 committed by xarkes
parent cd38fb9277
commit 391e847ebc
3 changed files with 11 additions and 2 deletions

View File

@ -44,6 +44,15 @@ void GeneralOptionsWidget::updateThemeFromConfig()
QString curTheme = Config()->getCurrentTheme(); QString curTheme = Config()->getCurrentTheme();
int index = themes.indexOf(curTheme) + 1; int index = themes.indexOf(curTheme) + 1;
ui->colorComboBox->setCurrentIndex(index); ui->colorComboBox->setCurrentIndex(index);
int maxThemeLen = 0;
for (QString str : themes){
int strLen = str.length();
if (strLen > maxThemeLen) {
maxThemeLen = strLen;
}
}
ui->colorComboBox->setMinimumContentsLength(maxThemeLen);
ui->colorComboBox->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength);
connect(ui->colorComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(on_colorComboBox_currentIndexChanged(int))); connect(ui->colorComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(on_colorComboBox_currentIndexChanged(int)));
} }

View File

@ -129,7 +129,7 @@ protected:
void adjustSize(int new_width, int new_height); void adjustSize(int new_width, int new_height);
bool event(QEvent *event); bool event(QEvent *event) override;
private: private:
bool checkPointClicked(QPointF &point, int x, int y, bool above_y=false); bool checkPointClicked(QPointF &point, int x, int y, bool above_y=false);

View File

@ -432,7 +432,7 @@ std::array<QString, 3> HexdumpWidget::fetchHexdump(RVA addr, int lines)
cur_addr += cols; cur_addr += cols;
} }
return { offsetText, hexText, asciiText}; return {{offsetText, hexText, asciiText}};
} }
void HexdumpWidget::selectionChanged() void HexdumpWidget::selectionChanged()