Commit 3a8b64c7 authored by Hahn, Steven's avatar Hahn, Steven
Browse files

Start removing Qt3 compatibility members.

parent 81d0af62
......@@ -741,7 +741,7 @@ void AlgorithmDialog::helpClicked() {
* A slot to handle the keep open button click
*/
void AlgorithmDialog::keepOpenChanged(int state) {
m_keepOpen = (state == QCheckBox::On);
m_keepOpen = (state == Qt::Checked);
}
//-------------------------------------------------------------------------------------------------
......
......@@ -460,7 +460,7 @@ namespace API
widget->setVisible( visible );
} // for each property
this->repaint(true);
this->repaint();
}
//-------------------------------------------------------------------------------------------------
......
......@@ -96,7 +96,7 @@ namespace MantidQt{
for (QFileInfoList::iterator it = info.begin(); it != info.end(); ++it)
{
colorMapNames.append(it->baseName());
colorMapFiles.append(it->absFilePath());
colorMapFiles.append(it->absoluteFilePath());
}
}
......
......@@ -161,7 +161,7 @@ bool MdSettings::getUsageGeneralMdColorMap()
QSettings settings;
settings.beginGroup(m_generalMdGroup);
bool flag = settings.value(m_lblUseGeneralMdColorMap, false).asBool();
bool flag = settings.value(m_lblUseGeneralMdColorMap, false).toBool();
settings.endGroup();
return flag;
......@@ -181,7 +181,7 @@ bool MdSettings::getUsageLastSession()
QSettings settings;
settings.beginGroup(m_vsiGroup);
bool flag = settings.value(m_lblUseLastSessionColorMap, false).asBool();
bool flag = settings.value(m_lblUseLastSessionColorMap, false).toBool();
settings.endGroup();
return flag;
......@@ -201,7 +201,10 @@ QString MdSettings::getUserSettingInitialView()
QSettings settings;
settings.beginGroup(m_vsiGroup);
QString initialView = settings.value(m_lblUserSettingInitialView, m_mdConstants.getTechniqueDependence()).asString();
QString initialView = settings
.value(m_lblUserSettingInitialView,
m_mdConstants.getTechniqueDependence())
.toString();
settings.endGroup();
return initialView;
......@@ -212,7 +215,7 @@ bool MdSettings::getLastSessionLogScale()
QSettings settings;
settings.beginGroup(m_vsiGroup);
bool logScale = settings.value(m_lblLastSessionLogScale, false).asBool();
bool logScale = settings.value(m_lblLastSessionLogScale, false).toBool();
settings.endGroup();
return logScale;
......
......@@ -199,7 +199,7 @@ PropertyWidget::PropertyWidget(Mantid::Kernel::Property *prop, QWidget *parent,
if (!m_gridLayout) {
// Create a LOCAL grid layout
m_gridLayout = new QGridLayout(this, 1, 5);
m_gridLayout = new QGridLayout(this);
m_gridLayout->setSpacing(5);
this->setLayout(m_gridLayout);
m_row = 0;
......
......@@ -1009,9 +1009,7 @@ QString RepoModel::UploadForm::email(){
QString RepoModel::UploadForm::author(){
return author_le->text();
}
QString RepoModel::UploadForm::comment(){
return comment_te->text();
}
QString RepoModel::UploadForm::comment() { return comment_te->toPlainText(); }
bool RepoModel::UploadForm::saveInfo(){
return save_ck->isChecked();
}
......@@ -1057,7 +1055,7 @@ RepoModel::DeleteQueryBox::~DeleteQueryBox(){
}
QString RepoModel::DeleteQueryBox::comment(){
if (comment_te)
return comment_te->text();
return comment_te->toPlainText();
else
return QString();
......
......@@ -54,7 +54,7 @@ namespace MantidQt
Mantid::API::AnalysisDataService::Instance().retrieve(wsName)
);
if (!tws) return; // just in case
m_form.cbColumnE->insertItem(""); // the default value
m_form.cbColumnE->insertItem(-1, ""); // the default value
std::vector<std::string> columns = tws->getColumnNames();
if (columns.empty()) return;
QString defaultXColumn;
......@@ -63,9 +63,9 @@ namespace MantidQt
for(std::vector<std::string>::const_iterator column = columns.begin(); column != columns.end(); ++column)
{
QString qName = QString::fromStdString(*column);
m_form.cbColumnX->insertItem(qName);
m_form.cbColumnY->insertItem(qName);
m_form.cbColumnE->insertItem(qName);
m_form.cbColumnX->insertItem(-1, qName);
m_form.cbColumnY->insertItem(-1, qName);
m_form.cbColumnE->insertItem(-1, qName);
Mantid::API::Column_sptr col = tws->getColumn(*column);
if (col->getPlotType() == 1 && defaultXColumn.isEmpty()) // type X
{
......
......@@ -381,15 +381,15 @@ void FitDialog::tieStaticWidgets(const bool readHistory) {
QStringList allowedDomainTypes = getAllowedPropertyValues("DomainType");
// Disable some domain types in the GUI until their imlpementations have been
// finished
allowedDomainTypes.remove("Sequential");
allowedDomainTypes.remove("Parallel");
allowedDomainTypes.removeAll("Sequential");
allowedDomainTypes.removeAll("Parallel");
m_form.cbDomainType->addItems(allowedDomainTypes);
// tie(m_form.cbDomainType, "DomainType", m_form.staticLayout, readHistory);
connect(m_form.cbDomainType, SIGNAL(currentIndexChanged(int)), this,
SLOT(domainTypeChanged()));
QString domainTypeValue = getStoredPropertyValue("DomainType");
if (!domainTypeValue.isEmpty()) {
m_form.cbDomainType->setCurrentText(domainTypeValue);
m_form.cbDomainType->setItemText(-1, domainTypeValue);
}
// this creates input workspace widgets and adjusts minimizers list
......@@ -411,14 +411,14 @@ void FitDialog::domainTypeChanged() {
getDomainTypeString().toStdString());
auto minimizerList = getAllowedPropertyValues("Minimizer");
if (getDomainType() != 0) {
minimizerList.remove("Levenberg-Marquardt");
minimizerList.removeAll("Levenberg-Marquardt");
}
QString currentMinimizer = m_form.cbMinimizer->currentText();
m_form.cbMinimizer->clear();
m_form.cbMinimizer->addItems(minimizerList);
int index = m_form.cbMinimizer->findText(currentMinimizer);
if (index >= 0) {
m_form.cbMinimizer->setCurrentText(currentMinimizer);
m_form.cbMinimizer->setItemText(-1, currentMinimizer);
}
createInputWorkspaceWidgets();
}
......
......@@ -253,7 +253,7 @@ namespace MantidQt
if( !m_form.fileWidget->isValid() ) return;
// First step is the get the specific loader that is responsible
auto loadAlg = getAlgorithm();
const QString filenames = m_form.fileWidget->getUserInput().asString();
const QString filenames = m_form.fileWidget->getUserInput().toString();
if( filenames == m_currentFiles ) return;
m_currentFiles = filenames;
removeOldInputWidgets(m_form.propertyLayout); // The new file might be invalid
......
......@@ -207,7 +207,7 @@ void SortTableWorkspaceDialog::addColumn()
{
if ( !m_sortColumns.contains(name) )
{
columnName->setCurrentText( name );
columnName->setItemText(-1, name);
break;
}
}
......
......@@ -327,7 +327,7 @@ void StartLiveDataDialog::setDefaultAccumulationMethod(const QString& inst)
// If 'Add' is currently selected, select 'Replace' instead
if ( ui.cmbAccumulationMethod->currentIndex() == addIndex )
{
ui.cmbAccumulationMethod->setCurrentText("Replace");
ui.cmbAccumulationMethod->setItemText(-1, "Replace");
}
// Disable the 'Add' option in the combobox. It just wouldn't make sense.
ui.cmbAccumulationMethod->setItemData(addIndex, false, Qt::UserRole - 1);
......@@ -389,7 +389,7 @@ void StartLiveDataDialog::initListenerPropLayout(const QString& inst)
QString propName = QString::fromStdString((**prop).name());
if ( m_algProperties.contains( propName ) )
{
m_algProperties.remove( propName );
m_algProperties.removeAll(propName);
}
}
......
......@@ -158,7 +158,7 @@ void DataComparison::addDataItem(Workspace_const_sptr ws)
return;
}
QString wsName = QString::fromStdString(matrixWs->name());
std::string wsName = matrixWs->name();
// Append a new row to the data table
int currentRows = m_uiForm.twCurrentData->rowCount();
......@@ -191,7 +191,7 @@ void DataComparison::addDataItem(Workspace_const_sptr ws)
m_uiForm.twCurrentData->setCellWidget(currentRows, COLOUR, colourCombo);
// Insert the workspace name
QTableWidgetItem *wsNameItem = new QTableWidgetItem(tr(wsName));
QTableWidgetItem *wsNameItem = new QTableWidgetItem(tr(wsName.c_str()));
wsNameItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
m_uiForm.twCurrentData->setItem(currentRows, WORKSPACE_NAME, wsNameItem);
......@@ -373,7 +373,8 @@ void DataComparison::plotWorkspaces()
}
// Update current spectrum display
m_uiForm.twCurrentData->item(row, CURRENT_SPEC)->setText(tr(QString::number(wsIndex)));
m_uiForm.twCurrentData->item(row, CURRENT_SPEC)
->setText(tr(std::to_string(wsIndex).c_str()));
// Create the curve data
const bool logScale(false), distribution(false);
......
......@@ -128,7 +128,7 @@ void ApplyPaalmanPings::run() {
} else {
// Check for same binning across sample and container
if (!checkWorkspaceBinningMatches(sampleWs, canCloneWs)) {
QString text =
const char *text =
"Binning on sample and container does not match."
"Would you like to rebin the container to match the sample?";
......@@ -165,15 +165,14 @@ void ApplyPaalmanPings::run() {
if (interpolateAll) {
result = QMessageBox::Yes;
} else {
QString text = "Number of bins on sample and " +
QString::fromStdString(factorWs->name()) +
" workspace does not match.\n" +
"Would you like to interpolate this workspace to "
"match the sample?";
result = QMessageBox::question(NULL, tr("Interpolate corrections?"),
tr(text), QMessageBox::YesToAll,
QMessageBox::Yes, QMessageBox::No);
std::string text = "Number of bins on sample and " +
factorWs->name() + " workspace does not match.\n" +
"Would you like to interpolate this workspace to "
"match the sample?";
result = QMessageBox::question(
NULL, tr("Interpolate corrections?"), tr(text.c_str()),
QMessageBox::YesToAll, QMessageBox::Yes, QMessageBox::No);
}
switch (result) {
......
......@@ -95,23 +95,23 @@ void ContainerSubtraction::run() {
}
else {
if (!checkWorkspaceBinningMatches(sampleWs, canCloneWs)) {
QString text =
"Binning on sample and container does not match."
"Would you like to rebin the container to match the sample?";
int result = QMessageBox::question(NULL, tr("Rebin sample?"), tr(text),
QMessageBox::Yes, QMessageBox::No,
QMessageBox::NoButton);
if (result == QMessageBox::Yes) {
IAlgorithm_sptr rebin =
AlgorithmManager::Instance().create("RebinToWorkspace");
rebin->initialize();
rebin->setProperty("WorkspaceToRebin", canCloneWs);
rebin->setProperty("WorkspaceToMatch", sampleWs);
rebin->setProperty("OutputWorkspace", canCloneName.toStdString());
rebin->execute();
}
const char *text =
"Binning on sample and container does not match."
"Would you like to rebin the container to match the sample?";
int result = QMessageBox::question(
NULL, tr("Rebin sample?"), tr(text), QMessageBox::Yes,
QMessageBox::No, QMessageBox::NoButton);
if (result == QMessageBox::Yes) {
IAlgorithm_sptr rebin =
AlgorithmManager::Instance().create("RebinToWorkspace");
rebin->initialize();
rebin->setProperty("WorkspaceToRebin", canCloneWs);
rebin->setProperty("WorkspaceToMatch", sampleWs);
rebin->setProperty("OutputWorkspace", canCloneName.toStdString());
rebin->execute();
}
else {
m_batchAlgoRunner->clearQueue();
g_log.error("Cannot apply absorption corrections using a sample and "
......
......@@ -1721,7 +1721,7 @@ QString ConvFit::convertFuncToShort(const QString &original) {
} else {
return "SFT";
}
auto pos = original.find("Circle");
auto pos = original.indexOf("Circle");
if (pos != -1) {
result += "DC";
} else {
......
......@@ -82,9 +82,10 @@ bool ISISEnergyTransfer::validate() {
double rebinWidth = m_uiForm.spRebinWidth->value();
if (rebinWidth < 0) {
// Ensure negative bin width is intentionally logarithmic
QString text = "The Binning width is currently negative, this suggests "
"you wish to use logarithmic binning.\n"
" Do you want to use Logarithmic Binning?";
const char *text =
"The Binning width is currently negative, this suggests "
"you wish to use logarithmic binning.\n"
" Do you want to use Logarithmic Binning?";
int result = QMessageBox::question(
NULL, tr("Logarithmic Binning"), tr(text), QMessageBox::Yes,
QMessageBox::No, QMessageBox::NoButton);
......
......@@ -31,7 +31,7 @@ void IndirectLoadILL::setup() {}
bool IndirectLoadILL::validate() {
QString filename = m_uiForm.mwRun->getFirstFilename();
QFileInfo finfo(filename);
QString ext = finfo.extension().toLower();
QString ext = finfo.suffix().toLower();
bool invalidExt = (ext != "asc" && ext != "inx" && ext != "nxs");
......@@ -56,7 +56,7 @@ void IndirectLoadILL::run() {
QString filename = m_uiForm.mwRun->getFirstFilename();
QFileInfo finfo(filename);
QString ext = finfo.extension().toLower();
QString ext = finfo.suffix().toLower();
QString instrument = m_uiForm.iicInstrumentConfiguration->getInstrumentName();
QString analyser = m_uiForm.iicInstrumentConfiguration->getAnalyserName();
......
......@@ -35,7 +35,7 @@ bool IndirectMolDyn::validate() {
QString filename = m_uiForm.mwRun->getFirstFilename();
QString version = m_uiForm.cbVersion->currentText();
QFileInfo finfo(filename);
QString ext = finfo.extension().toLower();
QString ext = finfo.suffix().toLower();
if (version == "3") {
if (ext != "dat" && ext != "cdl")
......
......@@ -134,11 +134,12 @@ void Quasi::run() {
auto saveDirectory = Mantid::Kernel::ConfigService::Instance().getString(
"defaultsave.directory");
if (saveDirectory.compare("") == 0) {
QString textMessage = "BayesQuasi requires a default save directory and "
"one is not currently set."
" If run, the algorithm will default to saving files "
"to the current working directory."
" Would you still like to run the algorithm?";
const char *textMessage =
"BayesQuasi requires a default save directory and "
"one is not currently set."
" If run, the algorithm will default to saving files "
"to the current working directory."
" Would you still like to run the algorithm?";
int result = QMessageBox::question(NULL, tr("Save Directory"),
tr(textMessage), QMessageBox::Yes,
QMessageBox::No, QMessageBox::NoButton);
......
......@@ -2419,7 +2419,7 @@ void MantidEV::restore( QSettings *state, QString name, QComboBox *cmbx )
int val = state->value(name, -1).toInt();
if ( val > 0 )
{
cmbx->setCurrentItem( val );
cmbx->setCurrentIndex(val);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment