Java教程

QT乱翻书-QStringDemo

本文主要是介绍QT乱翻书-QStringDemo,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

跳转到大纲  码云

 

QT乱翻书-QStringDemo

#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>

namespace Ui {
class Widget;
}

class Widget : public QWidget
{
    Q_OBJECT

public:
    explicit Widget(QWidget *parent = 0);
    ~Widget();

private slots:
    void on_pushButton_clicked();

    void on_pushButton_2_clicked();

    void on_pushButton_3_clicked();

    void on_pushButton_4_clicked();

    void on_pushButton_5_clicked();

    void on_pushButton_6_clicked();

    void on_pushButton_7_clicked();

    void on_pushButton_8_clicked();

    void on_pushButton_9_clicked();

    void on_pushButton_10_clicked();

    void on_pushButton_11_clicked();

    void on_pushButton_12_clicked();

    void on_pushButton_13_clicked();

    void on_pushButton_14_clicked();

    void on_pushButton_15_clicked();

    void on_pushButton_16_clicked();

    void on_pushButton_17_clicked();

    void on_pushButton_18_clicked();

private:
    Ui::Widget *ui;
};

#endif // WIDGET_H
/********************************************************************************
** Form generated from reading UI file 'widget.ui'
**
** Created by: Qt User Interface Compiler version 5.9.1
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/

#ifndef UI_WIDGET_H
#define UI_WIDGET_H

#include <QtCore/QVariant>
#include <QtWidgets/QAction>
#include <QtWidgets/QApplication>
#include <QtWidgets/QButtonGroup>
#include <QtWidgets/QCheckBox>
#include <QtWidgets/QComboBox>
#include <QtWidgets/QGridLayout>
#include <QtWidgets/QGroupBox>
#include <QtWidgets/QHBoxLayout>
#include <QtWidgets/QHeaderView>
#include <QtWidgets/QLabel>
#include <QtWidgets/QLineEdit>
#include <QtWidgets/QPushButton>
#include <QtWidgets/QSpinBox>
#include <QtWidgets/QVBoxLayout>
#include <QtWidgets/QWidget>

QT_BEGIN_NAMESPACE

class Ui_Widget
{
public:
    QVBoxLayout *verticalLayout;
    QGridLayout *gridLayout_2;
    QLabel *label;
    QComboBox *comboBox1;
    QLabel *label_2;
    QComboBox *comboBox2;
    QHBoxLayout *horizontalLayout;
    QGroupBox *groupBox;
    QGridLayout *gridLayout_3;
    QPushButton *pushButton_14;
    QPushButton *pushButton;
    QPushButton *pushButton_2;
    QPushButton *pushButton_11;
    QPushButton *pushButton_12;
    QPushButton *pushButton_15;
    QPushButton *pushButton_16;
    QPushButton *pushButton_17;
    QPushButton *pushButton_13;
    QGroupBox *groupBox_3;
    QVBoxLayout *verticalLayout_2;
    QPushButton *pushButton_4;
    QPushButton *pushButton_5;
    QPushButton *pushButton_7;
    QPushButton *pushButton_9;
    QGroupBox *groupBox_2;
    QGridLayout *gridLayout_5;
    QPushButton *pushButton_6;
    QPushButton *pushButton_10;
    QPushButton *pushButton_3;
    QPushButton *pushButton_18;
    QPushButton *pushButton_8;
    QGridLayout *gridLayout;
    QLabel *label_3;
    QLineEdit *edtResult;
    QCheckBox *checkBox;
    QLabel *LabSpin;
    QSpinBox *spinBox;

    void setupUi(QWidget *Widget)
    {
        if (Widget->objectName().isEmpty())
            Widget->setObjectName(QStringLiteral("Widget"));
        Widget->resize(526, 339);
        QFont font;
        font.setPointSize(11);
        Widget->setFont(font);
        verticalLayout = new QVBoxLayout(Widget);
        verticalLayout->setSpacing(6);
        verticalLayout->setContentsMargins(11, 11, 11, 11);
        verticalLayout->setObjectName(QStringLiteral("verticalLayout"));
        gridLayout_2 = new QGridLayout();
        gridLayout_2->setSpacing(6);
        gridLayout_2->setObjectName(QStringLiteral("gridLayout_2"));
        label = new QLabel(Widget);
        label->setObjectName(QStringLiteral("label"));
        label->setMaximumSize(QSize(50, 16777215));

        gridLayout_2->addWidget(label, 0, 0, 1, 1);

        comboBox1 = new QComboBox(Widget);
        comboBox1->setObjectName(QStringLiteral("comboBox1"));
        comboBox1->setEditable(true);

        gridLayout_2->addWidget(comboBox1, 0, 2, 1, 1);

        label_2 = new QLabel(Widget);
        label_2->setObjectName(QStringLiteral("label_2"));
        label_2->setMaximumSize(QSize(50, 16777215));

        gridLayout_2->addWidget(label_2, 1, 0, 1, 1);

        comboBox2 = new QComboBox(Widget);
        comboBox2->setObjectName(QStringLiteral("comboBox2"));
        comboBox2->setEditable(true);

        gridLayout_2->addWidget(comboBox2, 1, 2, 1, 1);


        verticalLayout->addLayout(gridLayout_2);

        horizontalLayout = new QHBoxLayout();
        horizontalLayout->setSpacing(6);
        horizontalLayout->setObjectName(QStringLiteral("horizontalLayout"));
        groupBox = new QGroupBox(Widget);
        groupBox->setObjectName(QStringLiteral("groupBox"));
        gridLayout_3 = new QGridLayout(groupBox);
        gridLayout_3->setSpacing(6);
        gridLayout_3->setContentsMargins(11, 11, 11, 11);
        gridLayout_3->setObjectName(QStringLiteral("gridLayout_3"));
        pushButton_14 = new QPushButton(groupBox);
        pushButton_14->setObjectName(QStringLiteral("pushButton_14"));

        gridLayout_3->addWidget(pushButton_14, 3, 1, 1, 1);

        pushButton = new QPushButton(groupBox);
        pushButton->setObjectName(QStringLiteral("pushButton"));

        gridLayout_3->addWidget(pushButton, 0, 0, 1, 1);

        pushButton_2 = new QPushButton(groupBox);
        pushButton_2->setObjectName(QStringLiteral("pushButton_2"));

        gridLayout_3->addWidget(pushButton_2, 0, 1, 1, 1);

        pushButton_11 = new QPushButton(groupBox);
        pushButton_11->setObjectName(QStringLiteral("pushButton_11"));

        gridLayout_3->addWidget(pushButton_11, 1, 0, 1, 1);

        pushButton_12 = new QPushButton(groupBox);
        pushButton_12->setObjectName(QStringLiteral("pushButton_12"));

        gridLayout_3->addWidget(pushButton_12, 1, 1, 1, 1);

        pushButton_15 = new QPushButton(groupBox);
        pushButton_15->setObjectName(QStringLiteral("pushButton_15"));

        gridLayout_3->addWidget(pushButton_15, 2, 0, 1, 1);

        pushButton_16 = new QPushButton(groupBox);
        pushButton_16->setObjectName(QStringLiteral("pushButton_16"));

        gridLayout_3->addWidget(pushButton_16, 2, 1, 1, 1);

        pushButton_17 = new QPushButton(groupBox);
        pushButton_17->setObjectName(QStringLiteral("pushButton_17"));

        gridLayout_3->addWidget(pushButton_17, 4, 0, 1, 1);

        pushButton_13 = new QPushButton(groupBox);
        pushButton_13->setObjectName(QStringLiteral("pushButton_13"));

        gridLayout_3->addWidget(pushButton_13, 4, 1, 1, 1);


        horizontalLayout->addWidget(groupBox);

        groupBox_3 = new QGroupBox(Widget);
        groupBox_3->setObjectName(QStringLiteral("groupBox_3"));
        verticalLayout_2 = new QVBoxLayout(groupBox_3);
        verticalLayout_2->setSpacing(6);
        verticalLayout_2->setContentsMargins(11, 11, 11, 11);
        verticalLayout_2->setObjectName(QStringLiteral("verticalLayout_2"));
        pushButton_4 = new QPushButton(groupBox_3);
        pushButton_4->setObjectName(QStringLiteral("pushButton_4"));

        verticalLayout_2->addWidget(pushButton_4);

        pushButton_5 = new QPushButton(groupBox_3);
        pushButton_5->setObjectName(QStringLiteral("pushButton_5"));

        verticalLayout_2->addWidget(pushButton_5);

        pushButton_7 = new QPushButton(groupBox_3);
        pushButton_7->setObjectName(QStringLiteral("pushButton_7"));

        verticalLayout_2->addWidget(pushButton_7);

        pushButton_9 = new QPushButton(groupBox_3);
        pushButton_9->setObjectName(QStringLiteral("pushButton_9"));

        verticalLayout_2->addWidget(pushButton_9);


        horizontalLayout->addWidget(groupBox_3);

        groupBox_2 = new QGroupBox(Widget);
        groupBox_2->setObjectName(QStringLiteral("groupBox_2"));
        gridLayout_5 = new QGridLayout(groupBox_2);
        gridLayout_5->setSpacing(6);
        gridLayout_5->setContentsMargins(11, 11, 11, 11);
        gridLayout_5->setObjectName(QStringLiteral("gridLayout_5"));
        pushButton_6 = new QPushButton(groupBox_2);
        pushButton_6->setObjectName(QStringLiteral("pushButton_6"));

        gridLayout_5->addWidget(pushButton_6, 0, 0, 1, 1);

        pushButton_10 = new QPushButton(groupBox_2);
        pushButton_10->setObjectName(QStringLiteral("pushButton_10"));

        gridLayout_5->addWidget(pushButton_10, 0, 1, 1, 1);

        pushButton_3 = new QPushButton(groupBox_2);
        pushButton_3->setObjectName(QStringLiteral("pushButton_3"));

        gridLayout_5->addWidget(pushButton_3, 1, 0, 1, 1);

        pushButton_18 = new QPushButton(groupBox_2);
        pushButton_18->setObjectName(QStringLiteral("pushButton_18"));

        gridLayout_5->addWidget(pushButton_18, 2, 0, 1, 1);

        pushButton_8 = new QPushButton(groupBox_2);
        pushButton_8->setObjectName(QStringLiteral("pushButton_8"));

        gridLayout_5->addWidget(pushButton_8, 2, 1, 1, 1);


        horizontalLayout->addWidget(groupBox_2);


        verticalLayout->addLayout(horizontalLayout);

        gridLayout = new QGridLayout();
        gridLayout->setSpacing(6);
        gridLayout->setObjectName(QStringLiteral("gridLayout"));
        label_3 = new QLabel(Widget);
        label_3->setObjectName(QStringLiteral("label_3"));
        label_3->setMaximumSize(QSize(50, 16777215));

        gridLayout->addWidget(label_3, 0, 0, 1, 1);

        edtResult = new QLineEdit(Widget);
        edtResult->setObjectName(QStringLiteral("edtResult"));

        gridLayout->addWidget(edtResult, 0, 1, 1, 3);

        checkBox = new QCheckBox(Widget);
        checkBox->setObjectName(QStringLiteral("checkBox"));

        gridLayout->addWidget(checkBox, 1, 0, 1, 2);

        LabSpin = new QLabel(Widget);
        LabSpin->setObjectName(QStringLiteral("LabSpin"));
        LabSpin->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);

        gridLayout->addWidget(LabSpin, 1, 2, 1, 1);

        spinBox = new QSpinBox(Widget);
        spinBox->setObjectName(QStringLiteral("spinBox"));
        spinBox->setMaximum(1000);

        gridLayout->addWidget(spinBox, 1, 3, 1, 1);


        verticalLayout->addLayout(gridLayout);


        retranslateUi(Widget);

        QMetaObject::connectSlotsByName(Widget);
    } // setupUi

    void retranslateUi(QWidget *Widget)
    {
        Widget->setWindowTitle(QApplication::translate("Widget", "QString\345\270\270\347\224\250\345\212\237\350\203\275", Q_NULLPTR));
        label->setText(QApplication::translate("Widget", "str1", Q_NULLPTR));
        comboBox1->clear();
        comboBox1->insertItems(0, QStringList()
         << QApplication::translate("Widget", "G:\\Qt5Book\\QT5.9Study", Q_NULLPTR)
         << QApplication::translate("Widget", "G:\\Qt5Book\\QT5.9Study\\qw.cpp", Q_NULLPTR)
         << QApplication::translate("Widget", "\345\255\246\347\224\237\345\247\223\345\220\215\357\274\214\347\224\267\357\274\2141984-3-4\357\274\214\346\261\211\346\227\217\357\274\214\345\261\261\344\270\234", Q_NULLPTR)
        );
        label_2->setText(QApplication::translate("Widget", "str2", Q_NULLPTR));
        comboBox2->clear();
        comboBox2->insertItems(0, QStringList()
         << QApplication::translate("Widget", "\\", Q_NULLPTR)
         << QApplication::translate("Widget", ".cpp", Q_NULLPTR)
         << QApplication::translate("Widget", ":", Q_NULLPTR)
         << QApplication::translate("Widget", "\357\274\214", Q_NULLPTR)
        );
        groupBox->setTitle(QApplication::translate("Widget", "\345\255\227\347\254\246\344\270\262", Q_NULLPTR));
        pushButton_14->setText(QApplication::translate("Widget", "section", Q_NULLPTR));
        pushButton->setText(QApplication::translate("Widget", "Append", Q_NULLPTR));
        pushButton_2->setText(QApplication::translate("Widget", "Prepend", Q_NULLPTR));
        pushButton_11->setText(QApplication::translate("Widget", "toUpper", Q_NULLPTR));
        pushButton_12->setText(QApplication::translate("Widget", "toLower", Q_NULLPTR));
        pushButton_15->setText(QApplication::translate("Widget", "left", Q_NULLPTR));
        pushButton_16->setText(QApplication::translate("Widget", "right", Q_NULLPTR));
        pushButton_17->setText(QApplication::translate("Widget", "simplified", Q_NULLPTR));
        pushButton_13->setText(QApplication::translate("Widget", "trimmed", Q_NULLPTR));
        groupBox_3->setTitle(QApplication::translate("Widget", "\346\225\260\345\255\227", Q_NULLPTR));
        pushButton_4->setText(QApplication::translate("Widget", "count", Q_NULLPTR));
        pushButton_5->setText(QApplication::translate("Widget", "size", Q_NULLPTR));
        pushButton_7->setText(QApplication::translate("Widget", "indexOf", Q_NULLPTR));
        pushButton_9->setText(QApplication::translate("Widget", "lastIndexOf", Q_NULLPTR));
        groupBox_2->setTitle(QApplication::translate("Widget", "\351\200\273\350\276\221\345\210\244\346\226\255", Q_NULLPTR));
        pushButton_6->setText(QApplication::translate("Widget", "endsWith", Q_NULLPTR));
        pushButton_10->setText(QApplication::translate("Widget", "startsWith", Q_NULLPTR));
        pushButton_3->setText(QApplication::translate("Widget", "contains", Q_NULLPTR));
        pushButton_18->setText(QApplication::translate("Widget", "isNull", Q_NULLPTR));
        pushButton_8->setText(QApplication::translate("Widget", "isEmpty", Q_NULLPTR));
        label_3->setText(QApplication::translate("Widget", "\347\273\223\346\236\234", Q_NULLPTR));
        checkBox->setText(QApplication::translate("Widget", "CheckBox", Q_NULLPTR));
        LabSpin->setText(QApplication::translate("Widget", "LabSpin", Q_NULLPTR));
    } // retranslateUi

};

namespace Ui {
    class Widget: public Ui_Widget {};
} // namespace Ui

QT_END_NAMESPACE

#endif // UI_WIDGET_H
#include "widget.h"
#include <QApplication>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    Widget w;
    w.show();

    return a.exec();
}
#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
{
    ui->setupUi(this);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::on_pushButton_clicked()
{//append()函数
    QString str1,str2;
    str1=ui->comboBox1->currentText();
    str2=ui->comboBox2->currentText();
    str1.append(str2);

    ui->edtResult->setText(str1);
}

void Widget::on_pushButton_2_clicked()
{//prepend()函数
    QString str1,str2;
    str1=ui->comboBox1->currentText();
    str2=ui->comboBox2->currentText();
    str1.prepend(str2);

    ui->edtResult->setText(str1);
}

void Widget::on_pushButton_3_clicked()
{//contains()函数
    QString str1,str2;
    str1=ui->comboBox1->currentText();
    str2=ui->comboBox2->currentText();

    bool chk;
    chk=str1.contains(str2);
    ui->checkBox->setChecked(chk);
    ui->checkBox->setText("contains()");
    ui->checkBox->sizeHint();
}

void Widget::on_pushButton_4_clicked()
{//count()函数
    QString str1=ui->comboBox1->currentText();
    int i=str1.count();
//    int i=str1.length();
    ui->spinBox->setValue(i);
    ui->LabSpin->setText("count()");
}

void Widget::on_pushButton_5_clicked()
{//size()函数
    QString str1;
    str1=ui->comboBox1->currentText();
    int i=str1.size();
    ui->spinBox->setValue(i);
    ui->LabSpin->setText("size()");

}

void Widget::on_pushButton_6_clicked()
{//endsWith()函数
    QString str1,str2;
    str1=ui->comboBox1->currentText();
    str2=ui->comboBox2->currentText();

    bool chk;
    chk=str1.endsWith(str2);
    ui->checkBox->setChecked(chk);
    ui->checkBox->setText("endsWith()");
    ui->checkBox->sizeHint();
}

void Widget::on_pushButton_7_clicked()
{//indexOf()函数
    QString str1,str2;
    str1=ui->comboBox1->currentText();
    str2=ui->comboBox2->currentText();

    int i;
    i=str1.indexOf(str2);
    ui->spinBox->setValue(i);
    ui->LabSpin->setText("indexOf()");
}

void Widget::on_pushButton_8_clicked()
{//isEmpty()函数
    QString str1;
    str1=ui->comboBox1->currentText();
    bool chk;
    chk=str1.isEmpty();
    ui->checkBox->setChecked(chk);
    ui->checkBox->setText("isEmpty()");
    ui->checkBox->sizeHint();
}

void Widget::on_pushButton_9_clicked()
{//lastIndexOf()函数
    QString str1,str2;
    str1=ui->comboBox1->currentText();
    str2=ui->comboBox2->currentText();

    int i;
    i=str1.lastIndexOf(str2);
    ui->spinBox->setValue(i);
    ui->LabSpin->setText("lastIndexOf()");
}

void Widget::on_pushButton_10_clicked()
{//startsWith()函数
    QString str1,str2;
    str1=ui->comboBox1->currentText();
    str2=ui->comboBox2->currentText();

    bool chk;
    chk=str1.startsWith(str2);
    ui->checkBox->setChecked(chk);
    ui->checkBox->setText("startsWith()");
    ui->checkBox->sizeHint();
}

void Widget::on_pushButton_11_clicked()
{//toUpper()函数
    QString str1,str2;
    str1=ui->comboBox1->currentText();
    str2=str1.toUpper();

    ui->edtResult->setText(str2);
}

void Widget::on_pushButton_12_clicked()
{//toLower()函数
    QString str1,str2;
    str1=ui->comboBox1->currentText();
    str2=str1.toLower();

    ui->edtResult->setText(str2);
}

void Widget::on_pushButton_13_clicked()
{//trimmed()函数
    QString str1;
    str1=ui->comboBox1->currentText();
    str1=str1.trimmed();

    ui->edtResult->setText(str1);

}

void Widget::on_pushButton_14_clicked()
{//section()函数
    int i;
    QString str1,str2,str3;
    str1=ui->comboBox1->currentText();
    i=ui->spinBox->value();
//    str2=str1.section('\\',2,2);
    str3=ui->comboBox2->currentText();
    if (QString::compare(str3,"\\",Qt::CaseInsensitive)==0)
        str2=str1.section('\\',i,i+1); //
    else
        str2=str1.section(str3,i,i+1); //

    ui->edtResult->setText(str2);
}

void Widget::on_pushButton_15_clicked()
{//left()函数
    QString str1,str2;
    str1=ui->comboBox1->currentText();
    int v=ui->spinBox->value();
    str2=str1.left(v);
    ui->edtResult->setText(str2);
}

void Widget::on_pushButton_16_clicked()
{//right()函数
    QString str1,str2;
    str1=ui->comboBox1->currentText();
    int cnt=str1.size();
    int v=ui->spinBox->value();
    str2=str1.right(cnt-v-1);
    ui->edtResult->setText(str2);
}

void Widget::on_pushButton_17_clicked()
{//simplified()函数
    QString str1;
    str1=ui->comboBox1->currentText();
    str1=str1.simplified();
    ui->edtResult->setText(str1);
}

void Widget::on_pushButton_18_clicked()
{//isNull()函数
    QString str1;
    str1=ui->comboBox1->currentText();
    bool chk;
    chk=str1.isNull();
    ui->checkBox->setChecked(chk);
    ui->checkBox->setText("isNull()");
    ui->checkBox->sizeHint();
}
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>Widget</class>
 <widget class="QWidget" name="Widget">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>746</width>
    <height>438</height>
   </rect>
  </property>
  <property name="font">
   <font>
    <pointsize>11</pointsize>
   </font>
  </property>
  <property name="windowTitle">
   <string>QString常用功能</string>
  </property>
  <layout class="QVBoxLayout" name="verticalLayout">
   <item>
    <layout class="QGridLayout" name="gridLayout_2">
     <item row="0" column="0">
      <widget class="QLabel" name="label">
       <property name="maximumSize">
        <size>
         <width>50</width>
         <height>16777215</height>
        </size>
       </property>
       <property name="text">
        <string>str1</string>
       </property>
      </widget>
     </item>
     <item row="0" column="2">
      <widget class="QComboBox" name="comboBox1">
       <property name="editable">
        <bool>true</bool>
       </property>
       <item>
        <property name="text">
         <string>G:\Qt5Book\QT5.9Study</string>
        </property>
       </item>
       <item>
        <property name="text">
         <string>G:\Qt5Book\QT5.9Study\qw.cpp</string>
        </property>
       </item>
       <item>
        <property name="text">
         <string>学生姓名,男,1984-3-4,汉族,山东</string>
        </property>
       </item>
      </widget>
     </item>
     <item row="1" column="0">
      <widget class="QLabel" name="label_2">
       <property name="maximumSize">
        <size>
         <width>50</width>
         <height>16777215</height>
        </size>
       </property>
       <property name="text">
        <string>str2</string>
       </property>
      </widget>
     </item>
     <item row="1" column="2">
      <widget class="QComboBox" name="comboBox2">
       <property name="editable">
        <bool>true</bool>
       </property>
       <item>
        <property name="text">
         <string>\</string>
        </property>
       </item>
       <item>
        <property name="text">
         <string>.cpp</string>
        </property>
       </item>
       <item>
        <property name="text">
         <string>:</string>
        </property>
       </item>
       <item>
        <property name="text">
         <string>,</string>
        </property>
       </item>
      </widget>
     </item>
    </layout>
   </item>
   <item>
    <layout class="QHBoxLayout" name="horizontalLayout">
     <item>
      <widget class="QGroupBox" name="groupBox">
       <property name="title">
        <string>字符串</string>
       </property>
       <layout class="QGridLayout" name="gridLayout_3">
        <item row="3" column="1">
         <widget class="QPushButton" name="pushButton_14">
          <property name="text">
           <string>section</string>
          </property>
         </widget>
        </item>
        <item row="0" column="0">
         <widget class="QPushButton" name="pushButton">
          <property name="text">
           <string>Append</string>
          </property>
         </widget>
        </item>
        <item row="0" column="1">
         <widget class="QPushButton" name="pushButton_2">
          <property name="text">
           <string>Prepend</string>
          </property>
         </widget>
        </item>
        <item row="1" column="0">
         <widget class="QPushButton" name="pushButton_11">
          <property name="text">
           <string>toUpper</string>
          </property>
         </widget>
        </item>
        <item row="1" column="1">
         <widget class="QPushButton" name="pushButton_12">
          <property name="text">
           <string>toLower</string>
          </property>
         </widget>
        </item>
        <item row="2" column="0">
         <widget class="QPushButton" name="pushButton_15">
          <property name="text">
           <string>left</string>
          </property>
         </widget>
        </item>
        <item row="2" column="1">
         <widget class="QPushButton" name="pushButton_16">
          <property name="text">
           <string>right</string>
          </property>
         </widget>
        </item>
        <item row="4" column="0">
         <widget class="QPushButton" name="pushButton_17">
          <property name="text">
           <string>simplified</string>
          </property>
         </widget>
        </item>
        <item row="4" column="1">
         <widget class="QPushButton" name="pushButton_13">
          <property name="text">
           <string>trimmed</string>
          </property>
         </widget>
        </item>
       </layout>
      </widget>
     </item>
     <item>
      <widget class="QGroupBox" name="groupBox_3">
       <property name="title">
        <string>数字</string>
       </property>
       <layout class="QVBoxLayout" name="verticalLayout_2">
        <item>
         <widget class="QPushButton" name="pushButton_4">
          <property name="text">
           <string>count</string>
          </property>
         </widget>
        </item>
        <item>
         <widget class="QPushButton" name="pushButton_5">
          <property name="text">
           <string>size</string>
          </property>
         </widget>
        </item>
        <item>
         <widget class="QPushButton" name="pushButton_7">
          <property name="text">
           <string>indexOf</string>
          </property>
         </widget>
        </item>
        <item>
         <widget class="QPushButton" name="pushButton_9">
          <property name="text">
           <string>lastIndexOf</string>
          </property>
         </widget>
        </item>
       </layout>
      </widget>
     </item>
     <item>
      <widget class="QGroupBox" name="groupBox_2">
       <property name="title">
        <string>逻辑判断</string>
       </property>
       <layout class="QGridLayout" name="gridLayout_5">
        <item row="0" column="0">
         <widget class="QPushButton" name="pushButton_6">
          <property name="text">
           <string>endsWith</string>
          </property>
         </widget>
        </item>
        <item row="0" column="1">
         <widget class="QPushButton" name="pushButton_10">
          <property name="text">
           <string>startsWith</string>
          </property>
         </widget>
        </item>
        <item row="1" column="0">
         <widget class="QPushButton" name="pushButton_3">
          <property name="text">
           <string>contains</string>
          </property>
         </widget>
        </item>
        <item row="2" column="0">
         <widget class="QPushButton" name="pushButton_18">
          <property name="text">
           <string>isNull</string>
          </property>
         </widget>
        </item>
        <item row="2" column="1">
         <widget class="QPushButton" name="pushButton_8">
          <property name="text">
           <string>isEmpty</string>
          </property>
         </widget>
        </item>
       </layout>
      </widget>
     </item>
    </layout>
   </item>
   <item>
    <layout class="QGridLayout" name="gridLayout">
     <item row="0" column="0">
      <widget class="QLabel" name="label_3">
       <property name="maximumSize">
        <size>
         <width>50</width>
         <height>16777215</height>
        </size>
       </property>
       <property name="text">
        <string>结果</string>
       </property>
      </widget>
     </item>
     <item row="0" column="1" colspan="3">
      <widget class="QLineEdit" name="edtResult"/>
     </item>
     <item row="1" column="0" colspan="2">
      <widget class="QCheckBox" name="checkBox">
       <property name="text">
        <string>CheckBox</string>
       </property>
      </widget>
     </item>
     <item row="1" column="2">
      <widget class="QLabel" name="LabSpin">
       <property name="text">
        <string>LabSpin</string>
       </property>
       <property name="alignment">
        <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
       </property>
      </widget>
     </item>
     <item row="1" column="3">
      <widget class="QSpinBox" name="spinBox">
       <property name="maximum">
        <number>1000</number>
       </property>
      </widget>
     </item>
    </layout>
   </item>
  </layout>
 </widget>
 <layoutdefault spacing="6" margin="11"/>
 <resources/>
 <connections/>
</ui>

 

这篇关于QT乱翻书-QStringDemo的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!