Qt实战程序1-图像文字编辑页面

效果图显示

在这里插入图片描述

部分代码

ImageProcessor::ImageProcessor(QWidget *parent)
    : QMainWindow(parent)
{
     setWindowTitle(tr("Image Processor"));

     showWidget =new ShowWidget(this);
     setCentralWidget(showWidget);
     fontLabel1 =new QLabel(tr("字体:")); //QLabel1
     fontComBox =new QFontComboBox;
     fontComBox->setFontFilters(QFontComboBox::ScalableFonts);

     fontLabel2 =new QLabel(tr("字号:")); //QLabel2
     sizeComBox =new QComboBox;
     QFontDatabase db;
     foreach(int size,db.standardSizes())
     sizeComBox->addItem(QString::number(size));

     boldBtn =new QToolButton;
     boldBtn->setIcon(QIcon("F:/project/qt/demo1/picture/bold.png"));
     boldBtn->setCheckable(true);

     italicBtn =new QToolButton;
     italicBtn->setIcon(QIcon("F:/project/qt/demo1/picture/italic.png"));
     italicBtn->setCheckable(true);

     underlineBtn =new QToolButton;
     underlineBtn->setIcon(QIcon("F:/project/qt/demo1/picture/underline.png"));
     underlineBtn->setCheckable(true);

     colorBtn =new QToolButton;
     colorBtn->setIcon(QIcon("F:/project/qt/demo1/picture/color.png"));
     colorBtn->setCheckable(true);
 /*    //排序
     listLabel =new QLabel(tr("排序"));     //list
     listComboBox =new QComboBox;
     listComboBox->addItem("Standard");
     listComboBox->addItem("QTextListFormat::ListDisc");
     listComboBox->addItem("QTextListFormat::ListCircle");
     listComboBox->addItem("QTextListFormat::ListSquare");
     listComboBox->addItem("QTextListFormat::ListDecimal");
     listComboBox->addItem("QTextListFormat::ListLowerAlpha");
     listComboBox->addItem("QTextListFormat::ListUpperAlpha");
     listComboBox->addItem("QTextListFormat::ListLowerRoman");
     listComboBox->addItem("QTextListFormat::ListUpperRoman");*/
     createActions();
     createMenus();
     createToolBars();
     if(img.load("F:/project/qt/demo1/picture/image.png"))
      {
          showWidget->imageLabel->setPixmap(QPixmap::fromImage(img));

      }
      connect(fontComBox,SIGNAL(activated(QString)),
              this,SLOT(ShowFontComboBox(QString)));
      connect(sizeComBox,SIGNAL(activated(QString)),
              this,SLOT(ShowSizeSpinBox(QString)));
      connect(boldBtn,SIGNAL(clicked()),this,SLOT(ShowBoldBtn()));
      connect(italicBtn,SIGNAL(clicked()),this,SLOT(ShowItalicBtn()));
      connect(underlineBtn,SIGNAL(clicked()),this,SLOT(ShowUnderlineBtn()));
      connect(colorBtn,SIGNAL(clicked()),this,SLOT(ShowColorBtn()));
      connect(showWidget->text,SIGNAL(currentCharFormatChanged(QTextCharFormat&)),
              this,SLOT(ShowCurrentFormatChanged(QTextCharFormat&)));
      connect(showWidget->text->document(),SIGNAL(undoAvailable(bool)),
              redoAction,SLOT(setEnabled(bool)));
      connect(showWidget->text->document(),SIGNAL(redoAvailable(bool)),
              redoAction,SLOT(setEnabled(bool)));
      connect(showWidget->text,SIGNAL(cursorPositionChanged()),
              this,SLOT(ShowCursorPositionChanged()));
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值