2010-04-06 829 views
9

我正在設計一個QLineEdit,它有四捨五入的邊框用作搜索框。邊界四捨五入本身很容易,但我無法弄清楚如何在焦點時將小部件突出顯示的部分四捨五入。我試過QLineEdit :: focus,但這隻能修改內部邊框。下面的圖片展示瞭如何獲得焦點時失去了四捨五入的錯覺。Qt 4.6 QLineEdit樣式。如何設計灰色突出顯示邊框的樣式,使其圓整?

QListView, QLineEdit { 
    color: rgb(127, 0, 63); 
    selection-color: white; 
    border: 2px groove gray; 
    border-radius: 10px; 
    padding: 2px 4px; 
} 
QLineEdit:focus { 
    color: rgb(127, 0, 63); 
    selection-color: white; 
    border: 2px groove gray; 
    border-radius: 10px; 
    padding: 2px 4px; 
} 

QLineEdit:edit-focus { 
    color: rgb(127, 0, 63); 
    selection-color: white; 
    border: 2px groove gray; 
    border-radius: 10px; 
    padding: 2px 4px; 
} 

圖像有和沒有重點: without http://img688.imageshack.us/img688/1986/screenshot20100406at310.png with http://img251.imageshack.us/img251/1986/screenshot20100406at310.png

回答

-1

造型QLineEdit:focus適當地應該把你的問題的關懷看到Qt Stylesheet Reference, List of Pseudo States

+0

僞狀態隻影響實際邊界,而不影響外部邊界。有可能我沒有適當地使用它。我添加了我的QLineEdit:focus和QLineEdit:編輯焦點樣式。照片保持不變。 – jkyle 2010-04-15 01:11:49

+0

是的你是對的,這實際上改變了窗口小部件的焦點時的窗口樣式,它不影響焦點矩形,增加了更好的答案,留下這個參考 – 2010-04-15 02:52:17