Skip to content

Commit

Permalink
doc: update docs for dwatermarkhelper
Browse files Browse the repository at this point in the history
更新dwatermarkhelper的文档,添加示例代码

Log: update docs

Issue:
  • Loading branch information
USFunction authored and kegechen committed Aug 29, 2024
1 parent 553522e commit 8aff15c
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
Binary file added docs/images/dwatermarkhelper_example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 45 additions & 0 deletions docs/widgets/dwatermarkhelper.zh_CN.dox
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,51 @@
@param[in] parent
@sa DWaterMaskHelper::instance

@details
### 实例代码
#### main.cpp

```cpp
#include <DApplication>
#include <DWaterMarkHelper>
#include <QMainWindow>

using namespace Dtk::Widget;


int main(int argc,char* argv[])
{
QApplication a(argc,argv);

QMainWindow w;
w.show();

auto ins = DWaterMarkHelper::instance();

WaterMarkData data = ins->data();
data.setText("dtk example");
data.setType(WaterMarkData::WaterMarkType::Text);
data.setLayout(WaterMarkData::WaterMarkLayout::Tiled) ;
data.setRotation(30);
data.setScaleFactor(0.5);
data.setColor(Qt::red);
QFont font;
font.setPointSize(30);
data.setFont(font);
data.setSpacing(65);
data.setLineSpacing(-1);
data.setOpacity(0.3);
data.setGrayScale(true);

ins->setData(data);

ins->registerWidget(&w);
return a.exec();
}
```
### 实例图片
@image html dwatermarkhelper_example.png

@fn DWaterMarkHelper::instance
@brief DWaterMarkHelper 的单例对象,使用 Q_GLOBAL_STATIC 定义,在第一次调用时实例化。

Expand Down

0 comments on commit 8aff15c

Please sign in to comment.