我想使用普通的QLineEdit
,并更改光标的形状。因此,像这样的子类:
class myLineEdit : public QLineEdit
{
Q_OBJECT
signals:
public:
explicit myLineEdit(QWidget * parent = 0)
{
}
protected:
};
并进行设置,使光标宽度达到几个像素,就像Linux终端一样。默认情况下,用于指示文本位置的光标非常细。
我假设我需要覆盖paintevent()
中的某些内容? paintevent
中究竟要负责绘制默认值的单个像素闪烁线QLineEdit()
?我在文档中找不到此信息。
答案 0 :(得分:1)
使用Qproxy样式:
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.3.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.0/jquery.validate.js"></script>
<form name="formval" class="form-horizontal col-md-8" method="post" action="">
<div class="form-group">
<label for="pr_amt" class="col-sm-4 control-label">Loan Amount</label>
<div class="col-sm-8">
<div class="input-group">
<span class="input-group-addon">SAR</span>
<input type="text" class="form-control input-sm" id="pr_amt" name="pr_amt" placeholder="Enter Loan Amount">
</div>
</div>
</div>
<div class="form-group">
<label for="period" class="col-sm-4 control-label">Down Payment</label>
<div class="col-sm-8">
<input type="text" class="form-control input-sm" id="period" placeholder="(in Saudi Riyal)" name="period">
</div>
</div>
<div class="form-group">
<label for="time" class="col-sm-4 control-label">Loan Tenure</label>
<div class="col-sm-8">
<input type="text" class="form-control input-sm" id="time" placeholder="(in months)" name="time">
</div>
</div>
<div class="form-group">
<label for="int_rate" class="col-sm-4 control-label">Rate of Interest</label>
<div class="col-sm-8">
<div class="input-group">
<input type="text" class="form-control input-sm" id="int_rate" name="int_rate">
<span class="input-group-addon">%</span>
</div>
</div>
</div>
<div class="form-group">
<label for="insurance_rate" class="col-sm-4 control-label">Inurance Rate</label>
<div class="col-sm-8">
<div class="input-group">
<input type="text" class="form-control input-sm" id="insurance_rate" name="insurance_rate">
<span class="input-group-addon">%</span>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-4 col-sm-12">
<button type="submit" name="calculate" value="Calculate" class="btn btn-primary">Calculate EMI</button>
<button type="reset" class="btn btn-link">Reset All</button>
</div>
</div>
</form>