uic: Fix some clang warnings
- Use range-based for - Use isEmpty() instead .size(), streamline code - Fix warnings about class definitions, use Q_DISABLE_COPY_MOVE and '= default' for trivial constructors Change-Id: I76255fd9d80c3faffebda9a438e86e918c16d289 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
parent
5343a7018e
commit
2e20ae3c1b
@ -498,9 +498,7 @@ void WriteInitialization::acceptUI(DomUI *node)
|
||||
<< language::startFunctionDefinition1("setupUi", parameterType, varName, m_option.indent);
|
||||
|
||||
const QStringList connections = m_uic->databaseInfo()->connections();
|
||||
for (int i=0; i<connections.size(); ++i) {
|
||||
QString connection = connections.at(i);
|
||||
|
||||
for (const auto &connection : connections) {
|
||||
if (connection == QLatin1String("(default)"))
|
||||
continue;
|
||||
|
||||
@ -900,8 +898,7 @@ void WriteInitialization::acceptLayout(DomLayout *node)
|
||||
if (m_layoutWidget) {
|
||||
bool left, top, right, bottom;
|
||||
left = top = right = bottom = false;
|
||||
for (int i = 0; i < propList.size(); ++i) {
|
||||
const DomProperty *p = propList.at(i);
|
||||
for (const DomProperty *p : propList) {
|
||||
const QString propertyName = p->attributeName();
|
||||
if (propertyName == QLatin1String("leftMargin") && p->kind() == DomProperty::Number)
|
||||
left = true;
|
||||
|
@ -161,7 +161,7 @@ private:
|
||||
// special initialization
|
||||
//
|
||||
class Item {
|
||||
Q_DISABLE_COPY(Item)
|
||||
Q_DISABLE_COPY_MOVE(Item)
|
||||
public:
|
||||
Item(const QString &itemClassName, const QString &indent, QTextStream &setupUiStream, QTextStream &retranslateUiStream, Driver *driver);
|
||||
~Item();
|
||||
|
@ -33,9 +33,7 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
DatabaseInfo::DatabaseInfo()
|
||||
{
|
||||
}
|
||||
DatabaseInfo::DatabaseInfo() = default;
|
||||
|
||||
void DatabaseInfo::acceptUI(DomUI *node)
|
||||
{
|
||||
@ -59,10 +57,9 @@ void DatabaseInfo::acceptWidget(DomWidget *node)
|
||||
DomProperty *db = properties.value(QLatin1String("database"));
|
||||
if (db && db->elementStringList()) {
|
||||
QStringList info = db->elementStringList()->elementString();
|
||||
|
||||
QString connection = info.size() > 0 ? info.at(0) : QString();
|
||||
if (connection.isEmpty())
|
||||
if (info.isEmpty() || info.constFirst().isEmpty())
|
||||
return;
|
||||
const QString &connection = info.constFirst();
|
||||
m_connections.append(connection);
|
||||
|
||||
QString table = info.size() > 1 ? info.at(1) : QString();
|
||||
|
@ -77,6 +77,9 @@ class DomButtonGroup;
|
||||
|
||||
struct TreeWalker
|
||||
{
|
||||
Q_DISABLE_COPY_MOVE(TreeWalker)
|
||||
|
||||
TreeWalker() = default;
|
||||
inline virtual ~TreeWalker() = default;
|
||||
|
||||
virtual void acceptUI(DomUI *ui);
|
||||
|
Loading…
Reference in New Issue
Block a user