10 #include <QHBoxLayout>
12 #include <QPushButton>
14 #include <QFileDialog>
41 mWarningMsg =
new QLabel(
this);
48 mWarningMsg->
setText(
"Gate library '" + defaultGl +
"' not found,\nplease select gate library from list.");
54 mWarningMsg->
setText(
"Gate library '" + defaultGl +
"' not found,\na substitute has been suggested.");
65 if (mWarningMsg->
text().isEmpty())
68 mCheckFullPath =
new QCheckBox(
"Show full path");
75 void GateLibrarySelection::handleGatelibIndexChanged(
int inx)
82 void GateLibrarySelection::handleInvokeFileDialog()
85 if (glFilename.
isEmpty())
return;
86 int inx =
static_cast<GateLibrarySelectionTable*
>(mComboGatelib->
model())->addGateLibrary(glFilename);
96 void GateLibrarySelection::handleShowFullPath(
bool checked)
117 if (mCount <= 0)
return mName;
119 case 1:
return mPath;
148 return mEntries.size();
165 if (glse.path() == path)
return inx;
166 nameMap[glse.name()]++;
182 if (glse.path() == path)
return inx;
195 if (glse.name() ==
name)
197 log_info(
"gui",
"Requested gate library '{}' not found, suggest '{}' instead.", path.
toStdString(), glse.path().toStdString());
198 mWarnSubstitute =
true;
211 if (inx < 0 || inx >= mEntries.size())
return QString();
212 return mEntries.at(inx).path();
218 mShowFullPath = checked;
QVariant data(int column, bool fullPath) const
QString gateLibraryPath() const
GateLibrarySelection(const QString &defaultGl, QWidget *parent=nullptr)
void handleShowFullPath(bool checked)
bool isWarnSubstitute() const
int columnCount(const QModelIndex &index=QModelIndex()) const override
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
int addGateLibrary(const QString &path)
int getIndexByPath(const QString &path)
GateLibrarySelectionTable(bool addAutoDetect, QObject *parent=nullptr)
int rowCount(const QModelIndex &index=QModelIndex()) const override
QString gateLibraryPath(int inx) const
#define log_info(channel,...)
std::vector< std::filesystem::path > get_all_path()
QIcon getStyledSvgIcon(const QString &from_to_colors_enabled, const QString &svg_path, QString from_to_colors_disabled=QString())
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const const override
void addLayout(QLayout *layout, int stretch)
void setCurrentIndex(int index)
void currentIndexChanged(int index)
QAbstractItemModel * model() const const
void setModel(QAbstractItemModel *model)
QString getOpenFileName(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFileDialog::Options options)
QString fileName() const const
void setFrameStyle(int style)
void setText(const QString &)
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
void setObjectName(const QString &name)
QString arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const const
QString fromStdString(const std::string &str)
bool isEmpty() const const
std::string toStdString() const const
virtual void polish(QWidget *widget)
virtual void unpolish(QWidget *widget)